// Downloaded From https://www.WiseStockTrader.com arg = ParamList("Weighted Close", "Close|Avg|WtClose|Median", 2); Const = Param("Constant", 10, .50, 10.5, 0.01); periods = Param("periods", 100, 10, 40, 1); Lb = Param("lb", 4, 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);