PureBytes Links
Trading Reference Links
|
If you want the line linking the last peak and the last trough,
no matter which is last, then
graph0 = c;graph0style=64;graph0barcolor=1;
x = cum(1);per = 3;
s1=l;s11=h;
pS = troughBars( s1, per, 1 ) == 0;
endt= lastvalue(ValueWhen( pS, x, 1 )); /*peak time*/
pR = PEAKBars( s11, per, 1 ) == 0;
endt1= lastvalue(ValueWhen( pR, x, 1 )); /*trough time*/
dt=iif(endt-endt1>0,endt-endt1,endt1-endt);
endS = lastvalue(ValueWhen( pS, s1, 1 ) ); /*peak value*/
endR = lastvalue(ValueWhen( pR, s11, 1 ) );/*trough value*/
aS=iif(endt-endt1>0,(endS-endR)/dt,-(endS-endR)/dt); /*slope*/
bS=iif(endt-endt1>0,endS,endR); /*beta*/
TR=aS*(x-max(endt,endt1))+bS;
graph1 = iif(x>min(endt,endt1)-10,tr,-1e10);
In different case, change the 1 in
troughBars( s1, per, 1 ) and/or PEAKBars( s11, per, 1 )
with 2, 3 etc
Dimitris Tsokakis
--- In amibroker@xxxx, Anthony Faragasso <ajf1111@xxxx> wrote:
> Tomasz;
>
> How do We graph a line from Point x ( trough) to point a (peak).
Could
> you help.
>
> Thank you.
> anthony.
|