Skip to main content

Rank Percent Based Smooth ATR for Amibroker (AFL)

kaphan90 about 6 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 3)
  • Tags:
    atr, amibroker, exploration, rank

Here are the Amibroker AFL codes for Percent Rank based ATR and colored candles according to the high volatility or low volatility zones.

High volatility zones are colored blue and low volatile zones are colored red. Exploration feature is added to find increasing/decreasing Percent rank with values.

Screenshots

Indicator / Formula

Copy & Paste Friendly

Apply to price chart

_SECTION_BEGIN("Percent Rank Based ATR");
periods = Param( "Periods", 20, 3, 200, 1 );
PRB_ATR=PercentRank(LinearReg(ATR(periods),periods),periods);

color = IIf(PRB_ATR > Ref(PRB_ATR,-1) OR PRB_ATR == 100,colorBlue,colorRed);
prbstatus = WriteIf(PRB_ATR > Ref(PRB_ATR,-1) OR PRB_ATR == 100,"Increasing","Decreasing");

Plot( PRB_ATR, "PRB-ATR", color, styleLine | styleThick );
_SECTION_END();

_SECTION_BEGIN("Exploration");

Filter = 1; //allow all
AddColumn(Close,"LTP",1.2);
AddColumn(PRB_ATR,"PRB_ATR",1.2,colorWhite,color);
AddTextColumn(prbstatus,"Status",1,colorWhite,color);

_SECTION_END();

0 comments

Leave Comment

Please login here to leave a comment.