Skip to main content

Trend Bands for Amibroker (AFL)

rogercraft about 16 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 5)
  • Tags:
    amibroker, bands

When prices cross or bounce at mid band the gold lines show projected profit targets.

The gold lines are calculated using ATR of central band.

The central band is created using EMA34 (or EMA55) of High and Low.

The opposite side of central band can be used as initial stop loss when trade is started.

Indicator / Formula

Copy & Paste Friendly
SetChartBkColor(colorGrey50);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%){{VALUES}}",
O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

SelPds = ParamList("Periods:", "34,55,89,144",0);

if( SelPds == "34" ) Pds= 34;
if( SelPds == "55" ) Pds= 55;

Middle = EMA(C,pds);

Himid = EMA(H,Pds);
Lomid = EMA(L,Pds);

UpperBand = Middle + 3.5 * ATR(Pds);
UpperBand1 = Middle + 1.75 * ATR(Pds);
LowerBand = Middle - 3.5 * ATR(Pds);
LowerBand1 = Middle - 1.75 * ATR(Pds);

Plot(C,"",colorBlack,styleCandle);

Plot(Middle, "Middle",colorCustom12,styleThick);
Plot(Himid, "",colorCustom12,styleDashed);
Plot(Lomid, "",colorCustom12,styleDashed);
Plot(UpperBand, "Upper",colorGold,styleThick);
Plot(UpperBand1, "",colorGold,styleDashed);
Plot(LowerBand, "Lower",colorGold,styleThick);
Plot(LowerBand1, "",colorGold,styleDashed);
PlotOHLC(Lomid,Himid,Lomid,Himid,"",ColorRGB(230,200,200),styleCloud | styleNoLabel);

0 comments

Leave Comment

Please login here to leave a comment.