// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("rrm_dpi"); //--created by Kelvinhand cBk =ParamColor("Background Color", colorBlack); cBkTitle =ParamColor("Background Title Color", colorBlack); SetChartBkGradientFill( cBk,cBk, cBkTitle); SetChartOptions( 3, 0, chartGridMiddle); cDodgerBlue = ColorRGB(30,144,255); DPIfast = Param("Fast", 8, 2,200); DPIslow = Param("Slow", 13, 2,200); DPIsig = Param("Signal", 13, 2,200); cDPI= ParamColor("DPI Color", colorDarkGrey); DPIThick = ParamToggle("DPI Thick", "No|Yes", 1); if (DPIThick) DPI_Style = styleNoLabel|styleThick; else DPI_Style = styleNoLabel; iMacd= MACD(DPIfast,DPIslow); iSig = MA(iMACD, DPIsig); iDiff = iMacd - iSig; iDPI = Null; iDPIMin =Null; iDPIMax = Null; dBull = Null; dBear = Null; for (i=0; i 0.0 && iMacd[i] > 0.0) iDPI[i] = Min(iDiff[i], iMacd[i]); if (iDiff[i] < 0.0 && iMacd[i] < 0.0) iDPI[i] = Max(iDiff[i], iMacd[i]); if (iMacd[i] > 0.0) dBull = Max(iDiff[i], iMacd[i]); else dBull = 0; if (iDiff[i] < 0.0) dBear = Min(iDiff[i], iMacd[i]); else { dBear = 0; dBull = Max(iDiff[i], iMacd[i]); } if (iMacd[i] < 0.0) dBear = Min(iDiff[i], iMacd[i]); if (abs(dBull) >= abs(dBear)) { iDPIMax[i] = Max(dBull, dBear); if (dBull < 0.0 || dBear < 0.0) iDPIMin[i] = Min(dBull, dBear); else iDPIMin[i] = Null; iLead[i] = Null; iFollow[i] = Null; } else { iLead[i] = Min(dBull[i], dBear[i]); if (dBull > 0.0 || dBear > 0.0) iFollow[i] = Max(dBull, dBear); else iFollow[i] = Null; iDPIMax[i] = Null; iDPIMin[i] = Null; } } Plot(iMacd, "Macd", cDodgerBlue, DPI_Style); Plot(iDiff, "Diff", colorRed, DPI_Style); //Plot(iSig, "", colorDarkGrey, styleNoLabel|styleThick|styleHistogram); Plot(iDPI, "", cDPI, DPI_Style|styleHistogram, Null, Null, 0, -1); Plot(iLead, "", colorRed, DPI_Style|styleHistogram, Null, Null, 0, -1); Plot(iFollow, "", colorRed, DPI_Style|styleHistogram, Null, Null, 0, -1); Plot(iDPIMax, "", colorGold, DPI_Style|styleHistogram, Null, Null, 0, -1); Plot(iDPIMin, "", colorGold, DPI_Style|styleHistogram, Null, Null, 0, -1); Plot(0, "", colorDarkGrey, styleNoLabel); //0 //--created by Kelvinhand _SECTION_END();