Click Image To Enlarge. Please Rate And Comment.
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hist = ml-sl;
MACUP = Hist > Ref(Hist,-1) AND Hist>0;
MACDN = Hist < 0 ;
BarColor = IIf(MACUP,colorLime,IIf(MACDN,colorCustom12,colorAqua));
//Plot( Hist, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) );
Plot( Hist, "MACD Histogram", BarColor , styleHistogram |styleThick|styleOwnScale);
//Plot(0, "0", colorBlack );
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//Trend Following Systems DO NOT work when ADX is Below 20 - Tech Analysis A-Z; page 120
P1 = Param("Period",14,0,100,1);
MyPDI= PDI(P1);//Positive Directional Indicator
MyMDI= MDI(P1);//Negative Directional Indicator (Minus)
MyADX= ADX(P1);//Average Directional Movement Index
//Green ADX Line=Rising; Red ADX Line=Falling
col = IIf( MyADX > Ref( MyADX, -1 ), colorSeaGreen, colorAqua );
Plot( MyPDI,"+DI",colorLime, styleLine |styleThick);
Plot( MyMDI,"-DI",colorOrange, styleLine |styleThick);
Plot( MyADX,"ADX",col, styleDots );
Title=Name()+ " " + Date() + " Price: " + C + EncodeColor(colorBlack) +" ADX" + WriteVal( MyADX )+ EncodeColor(colorGreen) + "
+DMI" + WriteVal( MyPDI )+ EncodeColor(colorRed) + " -DMI" + WriteVal( MyMDI );
//BUY/SELL ;try to activate this, AFTER disactivate the other "plot lines" and simply drag-and-drop on the pricechart
//Buy=MAcup AND mypdi>mymdi AND ADX()<40;
//Sell=MACDn ;
//Buy=ExRem(Buy,Sell);
//Sell=ExRem(Sell,Buy);
//PlotShapes(IIf(Buy,shapeUpTriangle,shapeNone),colorAqua,0,L,Offset=-20);
//PlotShapes(IIf(Sell,shapeDownTriangle,shapeNone),colorCustom12,0,H,Offset=-20);