[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to find a specific peak/trough



PureBytes Links

Trading Reference Links

Franco,
Explore with
perc=5;//Calibrate sensitivity
//Last Peak detection
p1=PeakBars(H,perc,1)==0;x1=Cum(p1);x1max=LastValue(x1);
H1=ValueWhen(p1,H,1);p2=H1>LastValue(C);
//Last Trough Detection
t1=TroughBars(L,perc,1)==0;y1=Cum(t1);y1max=LastValue(y1);
L1=ValueWhen(t1,L,1);t2=L1<LastValue(C);
Filter= (p1 AND p2 AND x1==x1max) OR (t1 AND t2 AND y1==y1max);
AddColumn(H,"Last Peak",1.2);
AddColumn(L,"Last Trough",1.2);
Sell=p1 AND p2 AND x1==x1max;
Buy=t1 AND t2 AND y1==y1max;
Buy/Sell are indicative for graphic purposes.
Note that your restriction for a peak higher than the last Close 
[respectively a trough lower than the last Close] is not always 
satisfied, if the last Close is a new high [a new low].
DT
--- In amibroker@xxxx, "ffpsi" <ffpsi@xxxx> wrote:
> Tomasz and all,
> 
> it's possible to find, say, the most recent peak (or trough) wich 
was 
> higher (or lower) than today's Close?
> 
> It's a second time I post this message, but the first one (posted 
> about 7 hours ago) wasn't still arrived.
> 
> Best regards and thanks in advance
> 
> Franco