Hi,
I am using this trend line which works very well, I should say.
I do not know the programmer to give him credit for it, thanks to him w[censored]ver he is!
The problem I am having is that I am unable to get the last value to be as what is shown when you hover the mouse over the indicator!
I tired lastvalue() over all the variations that appears in the function list but it did not work.
I would appreciate any help.
----------8<------------------
pv:= Input("VeryLong=4,Long=3,Med=2,Short=1",1,4,3);
pp:= LastValue(If(pv=4,4,If(pv=3,2,If(pv=2,1,0.5))));
r0:= If(MP()>=Ref(MP(),-1),ATR(1),0);
r1:= Log(If(r0>0,ATR(1),HIGH)/HIGH);
r2:= Cum(r1)/Max(1,Cum(If(r0>0,1,0)));
r3:= LastValue(100*Exp(LastValue(r2)))*pp;
r4:= LastValue(PeakBars(2,H,r3))-LastValue(PeakBars(1,H,r3));
r5:= (LastValue(Peak(1,H,r3))-LastValue(Peak(2, H,r3)))/r4; {slope}
r6:= LastValue(Peak(2, H,r3))+(r5*(Cum(1)-LastValue(Cum(1)- PeakBars(2,H,r3))));
r7:= If(Cum(1) <LastValue(Cum(1)-PeakBars(2,H,r3)),BarsSince(Cum(1)>=LastValue(Cum(1)-PeakBars( 2,H,r3))),r6);
s0:= If(MP()<=Ref(MP(),-1),ATR(1),0);
s1:= Log(If(s0>0,ATR(1),LOW)/LOW);
s2:= Cum(s1)/Max(1,Cum(If(s0>0,1,0)));
s3:= LastValue(100*Exp(LastValue(s2)))*pp;
s4:= LastValue(TroughBars(2,L,s3))-LastValue(TroughBars(1,L,s3));
s5:= (LastValue(Trough(1,L,s3))-LastValue(Trough(2,L,s3)))/s4; {slope}
s6:= LastValue(Trough(2,L,s3))+(s5*(Cum(1)-LastValue(Cum(1)-TroughBars(2,L,s3))));
s7:= If(Cum(1)<LastValue(Cum(1)-TroughBars(2,L,s3)),BarsSince(Cum(1)>=LastValue(Cum(1 )-TroughBars(2, L,s3))),s6);
r7;s7;
----------8<------------------
Regards,
Bulli ;)