[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

If I read your message correctly, you ask for
"Tomasz and all,
it's possible to find, say, the most recent peak (or trough) wich 
was 
higher (or lower) than today's Close?"
Well, the exploration I wrote finds exactly the most recent peak 
[trough], ie what you asked.
Is it OK ?
If you do not want a reply to your [repeated] question, it is another 
subject. Maybe it is useful to somebody else...
Note that the exploration finds the points you asked and ONLY these.
It was not the easiest code, at least for me.
So, it was a nice exercise. I also show you that IT IS possible to 
find these points and IT IS NOT impossible.
DT

--- In amibroker@xxxx, "ffpsi" <ffpsi@xxxx> wrote:
> Dimitris,
> 
> thanks for your interesting and for the time you spent, but if you 
> plot your H and L, you can see the lines are identical to those 
ones 
> I achieve plotting my little formulas:
> 
> res = ref(Peak(H, 2.5, 1), -1);
> sup = ref(Trough(L, 2.5, 1), -1);
> 
> Plot(C,"Close",1,64);
> Plot(res,"peak",5,1);
> Plot(sup,"trough",4,1);
> 
> To avoid I repeat a long explanation, please, check my message 
14877. 
> There, I exposed (clearly, I hope), what I'm trying to realize.
> 
> Best regards and thanks in advance for your help,
> 
> Franco
> 
> --- In amibroker@xxxx, "dtsokakis" <TSOKAKIS@xxxx> wrote:
> > 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