Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Dynamic Positioning Indicator (DPI) for Amibroker (AFL)

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

DPI is a modified MACD indicator from Russ Horn.

Similar Indicators / Formulas

Febo RSI ..real indicator
Submitted by abhinavsingh over 8 years ago
Trading Volume Statistic
Submitted by tuanstock1 almost 6 years ago
Ergodic Oscillator
Submitted by dljtrader over 9 years ago
3 Days Track
Submitted by janet0211 about 10 years ago
Chande Momentum Oscillator
Submitted by klimpek over 9 years ago

Indicator / Formula

Copy & Paste Friendly
_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<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);							
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();

0 comments

Leave Comment

Please login here to leave a comment.

Back