PureBytes Links
Trading Reference Links
|
Dimitris...you are a genius....Thanks a lot
--- In amibroker@xxxx, "Dimitris Tsokakis" <TSOKAKIS@xxxx> wrote:
> Eugene,
> Here is the code fully aligned to your instructions.
> As you see in AAPL, we skip 6 peaks lower than the last one to
create the trendline linking
> peak0 with peak7, the first peak higher than peak0.
> Dimitris Tsokakis
>
>
> X=Cum(1);
> condP=Ref(H,-1)>Ref(H,-2) AND Ref(H,-1)>H AND Ref(H,-1)>Ref(C,-2);
> P=Ref(CONDP,1)*(X!=LastValue(X));
> Plot(C,"",4*P+1,64);
> endt= LastValue(ValueWhen( P, x, 1 ));
> endS = LastValue(ValueWhen( P, H, 1 ) );
> startt=LastValue(ValueWhen( P AND H>ends, x, 1 ));
> startS = LastValue( ValueWhen( P AND H>ends, H, 1 ));
> dtS =endt-startt;
> aS = (endS-startS)/dtS;bS = endS;
> tH = aS * ( x -endt ) + bS; tH1=IIf(X>STARTT-3,tH,-1E10);
> Plot(tH1,"",4,1);
|