Skip to main content

Peak & Valley for Amibroker (AFL)

mahesh.aranake over 15 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 11)
  • Tags:
    trading system, amibroker, pivots

I found this AFL on tatechnics site of Karthik Marar
It has apparently been created by Edward and posted on the site by Karma8 – All credits to the three for the post

Dear Admin – Please caution if the formula looks into the future

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Peak & Valley");
// E.M.Pottasch 09/06/10
nbar = Param("nbar",2,1,5,1); 

PHigh = H > Ref(HHV(H,nbar),-1) AND Ref(HHV(H,nbar),nbar) < H;
PHighPrice0 = ValueWhen(PHigh,H);
PHighPrice1 = IIf(PHighPrice0 AND BarsSince(PHigh) > nbar,PHighPrice0,Null);
PHighPrice2 = IIf(PHighPrice0 AND BarsSince(PHigh) <= nbar,PHighPrice0,Null);
PLow = L < Ref(LLV(L,nbar),-1) AND Ref(LLV(L,nbar),nbar) > L;
PLowPrice0 = ValueWhen(PLow,L); 
PLowPrice1 = IIf(PLowPrice0 AND BarsSince(Plow) > nbar,PLowPrice0,Null);
PLowPrice2 = IIf(PLowPrice0 AND BarsSince(Plow) <= nbar,PLowPrice0,Null);

GraphXSpace = 5;
SetChartOptions(0, chartShowDates);
Plot(C,"\nLast",colorWhite,styleCandle);

Plot(PHighPrice1,"\nPHighPrice",colorOrange,styleThick);
Plot(PHighPrice2,"",colorOrange,styleDots | styleNoLine);
Plot(PLowPrice1,"\nPLowPrice",colorBrightGreen,styleThick);
Plot(PLowPrice2,"",colorBrightGreen,styleDots | styleNoLine);

Buy=H>PHighPrice0;
Sell=L<PLowPrice0;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(IIf(Buy , shapeSmallUpTriangle, shapeNone) ,colorGreen, 0,L,-30); 
PlotShapes(IIf( Sell, shapeSmallDownTriangle, shapeNone) ,colorOrange, 0,H,-25);
_SECTION_END();

10 comments

over 15 years ago

SEEN SAME TYPE OF AFL CREATED BY PRAKASH SHENOI SOMEWERE ELSE, VERY GOOD AFL FOR INTRADAY TRADES/SWING TRADES.KARTHIK BHAI NAME IS ENOUGH FOR QUALITY AFL THANKS FOR THIS.

4. gopal
over 15 years ago

This will not be displayed in real time.
How can we use this for trading? Can someone explain for the forum ?

Thanks,
Gopal

5. Anthony
over 15 years ago

gopal you can use this indicator to look at support and resistance, so you can find breakout or breakdown easily.

10. DEEPBL6U
over 8 years ago

PLEASE ADD LATEST TWO TRENDLINES ONE UP AND ONE DOWN….GRATEFUL TO YOU

Leave Comment

Please login here to leave a comment.