Skip to main content

demand index for Amibroker (AFL)

maoinsect about 15 years ago Amibroker (AFL)

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

Converted it from tradstation,
It is quite close to the formula that was posted by Stev wiser.
A number of parameters setting was available
this is also discussed in some details in
http://forum.equis.com/forums/thread/21109.aspx

Screenshots

Indicator / Formula

Copy & Paste Friendly
//http://www.purebytes.com/archives/omega/2002/msg04345.html
//http://forum.equis.com/forums/thread/21109.aspx
arg = ParamList("Weighted Close", "Close|Avg|WtClose|Median", 2);
Const = Param("Constant", 5, .50, 10.5, 0.01);
periods = Param("periods", 19, 10, 40, 1);
Lb = Param("lb", 2, 2, 10, 1);
if(arg == "Close") WtClose = C;
if(arg == "Avg")	WtClose = Avg;
if(arg == "WtClose") WtClose = (H + L + C + C)/4;
if(arg == "Median") 	WtClose = (H + L)/2;
AvgTr = MA(HHV(H, Lb) - LLV(L, Lb), periods);
WtCratio = (WtClose - Ref(WtClose, -1))/Min(WtClose, Ref(WtClose, -1));
VolRatio = Volume/MA(Volume, periods);
Constant = ((WtClose * 3)/AvgTr) * abs(WtCRatio);
Constant = IIf(Constant > Const, Const, Constant);
Constant = VolRatio /exp(Constant);
BuyP = IIf(WtCRatio > 0, VolRatio, Constant);
SellP = IIf(WtCRatio > 0, Constant, VolRatio);
BuyPressure = EMA(BuyP, periods);
SellPressure = EMA(SellP, periods);
tmpDI = IIf(SellPressure > BuyPressure, -BuyPressure/SellPressure,
SellPressure/BuyPressure);
DMI = IIf(tmpDi < 0, -1 - tmpDI, 1 - tmpDI)*100;

Plot(dmi, "demand index", colorBlue, styleLine);

0 comments

Leave Comment

Please login here to leave a comment.