Rrm dpi

KelvinHand

Well-Known Member
#1
Rrm

I m throwing away this macd indicator. Coded last year, after playing, find that still not that good. Timing Entry issue.

To work , required Guppy Liked EMAs:
- Ribbon EMA 5,7,9,11,13
- Trend - EMA 34, 89
- PSAR(0.05, 0.5)



Code:
_SECTION_BEGIN("Dynamic Positioning Indicator");
//--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<BarCount; i++) 
{
            
      if (iDiff[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);								//6
Plot(iDiff, "Diff", colorRed,    DPI_Style);			//5

//Plot(iSig, "", colorDarkGrey,  styleNoLabel|styleThick|styleHistogram);			//7

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();
 
Last edited:
Thread starter Similar threads Forum Replies Date
B Equities 0

Similar threads