PureBytes Links
Trading Reference Links
|
1. To calculate peaks and troughs as resistances and supports, I prefer to use Ref() function, because breakouts couldn't correctly detect any time one of them happens the same day when a new peak (or trough) is established.
res = Ref(Peak(H,Change,1),-1);
sup = Ref(Trough(L,Change,1),-1);
2. As you suggested, I ran your full formula on ACG and these are the results:
ACG 12/11/2001 8.94 0.00
ACG 27/12/2001 0.00 7.25
Your yellow line reproduces last closing price, but what I need is the value indicated by my yellow line, that is 8.3, and not 7.25 or 7.94.
Thanks in advance and best regards,
Franco
----- Original Message -----
From: dtsokakis
To: amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, April 20, 2002 6:47 PM
Subject: [amibroker] Re: Peaks and Troughs detection
And here is the full formula for any use [AA explore mode and
indicator builder]
perc=5;//Calibrate sensitivity
//Last Peak detection
p1=PeakBars(H,perc,1)==0;
H1=ValueWhen(p1,H,1);p2=H1>LastValue(C);
p=p1 AND p2;x1=Cum(p);x1max=LastValue(x1);
//Last Trough Detection
t1=TroughBars(L,perc,1)==0;
L1=ValueWhen(t1,L,1);t2=L1<LastValue(C);
t=t1 AND t2;y1=Cum(t);y1max=LastValue(y1);
PeakA=p AND x1==x1max;
TroughA=t AND y1==y1max;
Filter= PeakA OR TroughA;
AddColumn(IIf(PeakA,H,0),"Last Peak",1.2);
AddColumn(IIf(TroughA,L,0),"Last Trough",1.2);
Sell=p AND x1==x1max;
Buy=t AND y1==y1max;
LastPt=ValueWhen(PeakA,Cum(1),1);
LastPeak=ValueWhen(PeakA,H,1);
LastTt=ValueWhen(TroughA,Cum(1),1);
LastTrough=ValueWhen(TroughA,L,1);
Plot(C,"",1,64);
Plot(IIf(Cum(1)>=LastPt,LastPeak,-1e10),"",4,1);
Plot(IIf(Cum(1)>=LastTt,LastTrough,-1e10),"",5,1);
Plot(IIf(Cum(1)>=Max(LastPt,LastTt),LastValue(C),-1e10),"",7,1);
I do not think I have something more to add.
DT
--- In amibroker@xxxx, "dtsokakis" <TSOKAKIS@xxxx> wrote:
> Franco,
> If the previous code was confusing you, try this one.
> In AA select a stock and EXPLORE for all quotations.
> Then double click on the results list.
> You read the values of the last Peak [Last trough] above [below]
last
> close value [I forced the useless reading to zero] and the arrows
> mark the respective points.
> If you need anything else, please advise.
> DT
>
> perc=5;//Calibrate sensitivity
> //Last Peak detection
> p1=PeakBars(H,perc,1)==0;
> H1=ValueWhen(p1,H,1);p2=H1>LastValue(C);
> p=p1 AND p2;x1=Cum(p);x1max=LastValue(x1);
> //Last Trough Detection
> t1=TroughBars(L,perc,1)==0;
> L1=ValueWhen(t1,L,1);t2=L1<LastValue(C);
> t=t1 AND t2;y1=Cum(t);y1max=LastValue(y1);
> PeakA=p AND x1==x1max;
> TroughA=t AND y1==y1max;
> Filter= PeakA OR TroughA;
> AddColumn(IIf(PeakA,H,0),"Last Peak",1.2);
> AddColumn(IIf(TroughA,L,0),"Last Trough",1.2);
> Sell=p AND x1==x1max;
> Buy=t AND y1==y1max;
>
> --- In amibroker@xxxx, "dtsokakis" <TSOKAKIS@xxxx> wrote:
> > Franco,
> > please, read again
> > http://groups.yahoo.com/group/amibroker/message/14929
> > It is an exploration. It works in Automatic Analysis.
> > Select a stock, Explore for All quotations and then doubleclick
on
> > the results list.
> > You will see the arrows marking the points you ask.
> > It is NOT an ind. builder formula, there is nothing to be plotted.
> > The arrows are at the last peak [last trough] which satisfies the
> > above LastValue(close) requirement [respectively below LastValue
> > (close)]. If a peak [trough] does not fulfil this criterion is
> > skipped [we may change this priority, if you like.]
> > DT
> >
> > --- In amibroker@xxxx, franco fornari <ffpsi@xxxx> wrote:
> > > Dimitris,
> > >
> > > I'm manifestly not able to make me clear. Probably it
> > > depends on my poor english.
> > > Since I received more than one messages, out of
> > > chronological order (because Yahoo mail), I'll try to
> > > summarize my (maybe wrong) point of view.
> > >
> > > 1. Look, please, at the first two attached gif. They
> > > plot my and your formulas, respectively. Do you see
> > > any difference? I can't. Moreover, I suppose for the
> > > two lines of code:
> > >
> > > AddColumn(H,"Last Peak",1.2);
> > > AddColumn(L,"Last Trough",1.2);
> > >
> > > you really meant as follows:
> > >
> > > AddColumn(H1,"Last Peak",1.2);
> > > AddColumn(L1,"Last Trough",1.2);
> > >
> > > 2. Look, now, at the third attached gif. I have
> > > manually added a yellow line, wich shows what level I
> > > wish to detect: the last trough higher than last
> > > closing price. Not the last trough by absolute. In
> > > this case it is the second last, but sometimes it
> > > could be the third from last or more.
> > >
> > > 3. Running your exploration system, I don't find the
> > > value I need on the last line of results, but on the
> > > second last one. Then, it is not available for further
> > > applications.
> > >
> > > 4. You said "Single points localization is not the
> > > easiest AFL sport". Well, I think AmiBroker is very
> > > powerful, but I don't expect it is omnipotent. If you,
> > > or any other person so expert as you are, says a
> > > certain thing is not possible,
> >
> > As far as I read my text, I did not say anything impossible.
> > [how should I write such a thing !!]
> > Although this discussion is a bit confused, we could simplify
> things.
> >
> > I can accept this.
> > > Maybe Tomasz will turn it possible in future, or maybe
> > > not. Anyway, the life will go on.
> > >
> > > Best regards and thanks again for the time you spend
> > > to help me.
> > >
> > > Franco
> > >
> > >
> >
>
______________________________________________________________________
> > > Vinci i Mondiali - La Grande Sfida dei Mondiali FIFA
> > > http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/
> > >
> > >
> >
>
______________________________________________________________________
> > > Vinci i Mondiali - La Grande Sfida dei Mondiali FIFA
> > > http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/
> > >
> > >
> >
>
______________________________________________________________________
> > > Vinci i Mondiali - La Grande Sfida dei Mondiali FIFA
> > > http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------=_NextPart_001_004B_01C1E8AA.9D13F620
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Dimitris,</FONT></DIV>
<DIV><FONT face=Arial size=2> </FONT></DIV>
<DIV><FONT face=Arial size=2>as attachment, I send to you some newcharts
to clarify my thought.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1. To calculate peaks and troughs as
resistances and supports, I prefer to use Ref() function, because breakouts
couldn't correctly detect any time one of them happens the same day
when a new peak (or trough) is established.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>res = <FONT color=#0000ff>Ref</FONT>(<FONT
color=#0000ff>Peak</FONT>(<B>H</B>,Change,<FONT color=#ff00ff>1</FONT>),-<FONT
color=#ff00ff>1</FONT>);</FONT></DIV>
<DIV><FONT face=Arial size=2>sup = <FONT color=#0000ff>Ref</FONT>(<FONT
color=#0000ff>Trough</FONT>(<B>L</B>,Change,<FONT color=#ff00ff>1</FONT>),-<FONT
color=#ff00ff>1</FONT>);</FONT></DIV>
<DIV><FONT face=Arial size=1></FONT> </DIV>
<DIV><FONT face=Arial size=2>2. As you suggested, I ran your full formula on ACG
and these are the results:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>ACG 12/11/2001 8.94 0.00 <BR>ACG 27/12/2001 0.00 7.25 <BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Your yellow line reproduces last closing price, but
what I need is the value indicated by my yellow line, that is 8.3, and not 7.25
or 7.94.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks in advance and best regards,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Franco</DIV></FONT>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
dtsokakis
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=amibroker@xxxxxxxxxx
href="mailto:amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, April 20, 2002 6:47
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [amibroker] Re: Peaks and
Troughs detection</DIV>
<DIV><BR></DIV><TT>And here is the full formula for any use [AA explore mode
and <BR>indicator builder]<BR><BR>perc=5;//Calibrate sensitivity<BR>//Last
Peak
detection<BR>p1=PeakBars(H,perc,1)==0;<BR>H1=ValueWhen(p1,H,1);p2=H1>LastValue(C);<BR>p=p1
AND p2;x1=Cum(p);x1max=LastValue(x1);<BR>//Last Trough
Detection<BR>t1=TroughBars(L,perc,1)==0;<BR>L1=ValueWhen(t1,L,1);t2=L1<LastValue(C);<BR>t=t1
AND t2;y1=Cum(t);y1max=LastValue(y1);<BR>PeakA=p AND x1==x1max;<BR>TroughA=t
AND y1==y1max;<BR>Filter= PeakA OR TroughA;<BR>AddColumn(IIf(PeakA,H,0),"Last
Peak",1.2);<BR>AddColumn(IIf(TroughA,L,0),"Last Trough",1.2);<BR>Sell=pAND
x1==x1max;<BR>Buy=t AND
y1==y1max;<BR>LastPt=ValueWhen(PeakA,Cum(1),1);<BR>LastPeak=ValueWhen(PeakA,H,1);<BR>LastTt=ValueWhen(TroughA,Cum(1),1);<BR>LastTrough=ValueWhen(TroughA,L,1);<BR>Plot(C,"",1,64);<BR>Plot(IIf(Cum(1)>=LastPt,LastPeak,-1e10),"",4,1);<BR>Plot(IIf(Cum(1)>=LastTt,LastTrough,-1e10),"",5,1);<BR>Plot(IIf(Cum(1)>=Max(LastPt,LastTt),LastValue(C),-1e10),"",7,1);<BR><BR>I
do not think I have something more to add.<BR>DT<BR>--- In amibroker@xxxx,
"dtsokakis" <TSOKAKIS@xxxx> wrote:<BR>> Franco,<BR>> If the
previous code was confusing you, try this one.<BR>> In AA select a stock
and EXPLORE for all quotations.<BR>> Then double click on the results
list.<BR>> You read the values of the last Peak [Last trough] above [below]
<BR>last <BR>> close value [I forced the useless reading to zero] and the
arrows <BR>> mark the respective points.<BR>> If you need anything else,
please advise.<BR>> DT<BR>> <BR>> perc=5;//Calibrate
sensitivity<BR>> //Last Peak detection<BR>>
p1=PeakBars(H,perc,1)==0;<BR>>
H1=ValueWhen(p1,H,1);p2=H1>LastValue(C);<BR>> p=p1 AND
p2;x1=Cum(p);x1max=LastValue(x1);<BR>> //Last Trough Detection<BR>>
t1=TroughBars(L,perc,1)==0;<BR>>
L1=ValueWhen(t1,L,1);t2=L1<LastValue(C);<BR>> t=t1 AND
t2;y1=Cum(t);y1max=LastValue(y1);<BR>> PeakA=p AND x1==x1max;<BR>>
TroughA=t AND y1==y1max;<BR>> Filter= PeakA OR TroughA;<BR>>
AddColumn(IIf(PeakA,H,0),"Last Peak",1.2);<BR>>
AddColumn(IIf(TroughA,L,0),"Last Trough",1.2);<BR>> Sell=p AND
x1==x1max;<BR>> Buy=t AND y1==y1max;<BR>> <BR>> --- In
amibroker@xxxx, "dtsokakis" <TSOKAKIS@xxxx> wrote:<BR>> > Franco,
<BR>> > please, read again <BR>> > <A
href="http://groups.yahoo.com/group/amibroker/message/14929">http://groups.yahoo.com/group/amibroker/message/14929</A><BR>>
> It is an exploration. It works in Automatic Analysis.<BR>> > Select
a stock, Explore for All quotations and then doubleclick <BR>on <BR>> >
the results list.<BR>> > You will see the arrows marking the pointsyou
ask.<BR>> > It is NOT an ind. builder formula, there is nothing to be
plotted.<BR>> > The arrows are at the last peak [last trough] which
satisfies the <BR>> > above LastValue(close) requirement [respectively
below LastValue<BR>> > (close)]. If a peak [trough] does not fulfilthis
criterion is <BR>> > skipped [we may change this priority, if you
like.]<BR>> > DT<BR>> > <BR>> > --- In amibroker@xxxx,
franco fornari <ffpsi@xxxx> wrote:<BR>> > > Dimitris,<BR>>
> > <BR>> > > I'm manifestly not able to make me clear.
Probably it<BR>> > > depends on my poor english.<BR>> > >
Since I received more than one messages, out of<BR>> > >
chronological order (because Yahoo mail), I'll try to<BR>> > >
summarize my (maybe wrong) point of view.<BR>> > > <BR>> >>
1. Look, please, at the first two attached gif. They<BR>> > > plot my
and your formulas, respectively. Do you see<BR>> > > any difference?
I can't. Moreover, I suppose for the<BR>> > > two lines of
code:<BR>> > > <BR>> > > AddColumn(H,"Last
Peak",1.2);<BR>> > > AddColumn(L,"Last Trough",1.2);<BR>> >
> <BR>> > > you really meant as follows:<BR>> > >
<BR>> > > AddColumn(H1,"Last Peak",1.2);<BR>> > >
AddColumn(L1,"Last Trough",1.2);<BR>> > > <BR>> > > 2. Look,
now, at the third attached gif. I have<BR>> > > manually added a
yellow line, wich shows what level I<BR>> > > wish to detect: the
last trough higher than last<BR>> > > closing price. Not the last
trough by absolute. In<BR>> > > this case it is the second last,but
sometimes it<BR>> > > could be the third from last or more.<BR>>
> > <BR>> > > 3. Running your exploration system, I don't find
the<BR>> > > value I need on the last line of results, but on
the<BR>> > > second last one. Then, it is not available for
further<BR>> > > applications.<BR>> > > <BR>> > >
4. You said "Single points localization is not the<BR>> > > easiest
AFL sport". Well, I think AmiBroker is very<BR>> > > powerful, but I
don't expect it is omnipotent. If you,<BR>> > > or any other person
so expert as you are, says a<BR>> > > certain thing is not possible,
<BR>> > <BR>> > As far as I read my text, I did not say anything
impossible.<BR>> > [how should I write such a thing !!]<BR>> >
Although this discussion is a bit confused, we could simplify <BR>>
things.<BR>> > <BR>> > I can accept this.<BR>> > >
Maybe Tomasz will turn it possible in future, or maybe<BR>> > > not.
Anyway, the life will go on.<BR>> > > <BR>> > > Best regards
and thanks again for the time you spend<BR>> > > to help me.<BR>>
> > <BR>> > > Franco<BR>> > > <BR>> > >
<BR>> > <BR>>
<BR>______________________________________________________________________<BR>>
> > Vinci i Mondiali - La Grande Sfida dei Mondiali FIFA<BR>> >
> <A
href="http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/">http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/</A><BR>>
> > <BR>> > > <BR>> > <BR>>
<BR>______________________________________________________________________<BR>>
> > Vinci i Mondiali - La Grande Sfida dei Mondiali FIFA<BR>> >
> <A
href="http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/">http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/</A><BR>>
> > <BR>> > > <BR>> > <BR>>
<BR>______________________________________________________________________<BR>>
> > Vinci i Mondiali - La Grande Sfida dei Mondiali FIFA<BR>> >
> <A
href="http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/">http://it.yahoo.com/mail_it/foot/?http://lasfida.yahoo.net/</A><BR><BR></TT><BR><TT>Your
use of Yahoo! Groups is subject to the <A
href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</A>.</TT>
<BR></BLOCKQUOTE></BODY></HTML>
------=_NextPart_001_004B_01C1E8AA.9D13F620--
Attachment:
gif00302.gif
Attachment:
Description: "Description: GIF image"
|