Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Zerolag MACD for Amibroker (AFL)
Hi,
I came across this indicator somewhere on the net. Have been using this since three months. In my opinion, works best in trending market
I am new to this afl language. Credit goes to the original author.
Similar Indicators / Formulas
Indicator / Formula
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | _SECTION_BEGIN ( "ZeroLag MACD" ); /*Xero Lag MACD(p,q,r)*/ //based on ZeroLag EMA - see Technical Analysis of Stocks and Commodities, April 2000 p = Param ( "P" ,12,3,36,2); q = Param ( "Q" ,26,3,52,2); r = Param ( "R" ,9,3,15,1); EMA1= EMA ( Close ,p); EMA2= EMA (EMA1,p); Difference= EMA1 - EMA2; ZeroLagEMAp= EMA1 + Difference; //--------------------------------------- EMA1= EMA ( Close ,q); EMA2= EMA (EMA1,q); Difference= EMA1 - EMA2; ZeroLagEMAq= EMA1 + Difference; //--------------------------------------- ZeroLagMACD=ZeroLagEMAp - ZeroLagEMAq; //--------------------------------------- // Signal line EMA1= EMA (ZeroLagMACD,r); EMA2= EMA (EMA1,r); Difference= EMA1 - EMA2; ZeroLagTRIG= EMA1 + Difference; em_macd = EMA (zerolagMACD,5); Plot (em_MACD, "ema" , IIf (em_MACD > Ref (em_MACD,-1), colorBrightGreen , colorRed ), styleThick ); Plot (zerolagMACD, "zmacd" , IIf (zerolagMACD > Ref (zerolagMACD,-1), colorBrightGreen , colorRed ), styleThick + styleDots ); //diff_1 = ZeroLagMACD - em_macd; //Plot(diff_1,"hist",IIf(diff_1 > 0, colorBrightGreen, colorRed),styleHistogram); //Plot(diff_1,"hist",IIf(diff_1 > Ref(diff_1,-1), colorBrightGreen, colorRed),styleLine); Buy = Cover = Cross (zerolagmacd,em_macd); Sell = Short = Cross (em_macd,zerolagmacd); PlotShapes ( Buy * shapeUpTriangle , colorYellow ); PlotShapes ( Sell * shapeDownTriangle , colorYellow ); Plot (zerolagtrig, "" , IIf (zerolagtrig > Ref (zerolagtrig,-1), colorAqua , colorBlue ), styleDashed ); Plot (0, "" , colorWhite , styleNoLabel ); a = round (zerolagMACD*100)/100; a1 = Ref (a,-1); diff1 = round ((a - a1)*10)/10; diff2 = round ((a1 - Ref (a,-2))*10)/10; ST33= ZeroLagMACD; bars=50; TR1= LLVBars (ST33,5); COND1=TR1> 0 AND Ref (TR1,-1)==0 AND Ref (ST33,-1)<0; TR2= IIf (COND1, Ref (ST33,-1),0); M1= ValueWhen (COND1,ST33); P1= ValueWhen (COND1, LLV ( L ,3)); DM1=M1- Ref (M1,-1);DP1=P1- Ref (P1,-1); DT= Ref ( BarsSince (COND1),-1); POSDIV=DM1> 0 AND DP1<0 AND DT<BARS; TR11= HHVBars (ST33,5); COND11=TR11> 0 AND Ref (TR11,-1)==0 AND Ref (ST33,-1)>0; TR21= IIf (COND11, Ref (ST33,-1),0); M11= ValueWhen (COND11,ST33); P11= ValueWhen (COND11, HHV ( H ,3)); DM11=M11- Ref (M11,-1);DP11=P11- Ref (P11,-1); DT1= Ref ( BarsSince (COND11),-1); NEGDIV=DM11< 0 AND DP11>0 AND DT1<BARS; PlotShapes ( shapeDigit3 *POSDIV, colorBrightGreen ); PlotShapes ( shapeDigit3 *NEGDIV, colorRed ); Title = EncodeColor ( colorYellow )+ "MACD : " + WriteIf (a > 0, EncodeColor ( colorGreen )+a, EncodeColor ( colorRed )+a) + WriteIf (diff1 > 0, EncodeColor ( colorGreen )+ " Up by " +diff1, EncodeColor ( colorRed )+ " Dn by " +diff1) + "\n" + EncodeColor ( colorYellow )+ "One bar ago : " + WriteIf (a1 > 0, EncodeColor ( colorGreen )+a1, EncodeColor ( colorRed )+a1) + WriteIf (diff2 > 0, EncodeColor ( colorGreen )+ " Up by " +diff2, EncodeColor ( colorRed )+ " Dn by " +diff2) ; //===========================end zeroLagMACD _SECTION_END (); |
0 comments
Leave Comment
Please login here to leave a comment.
Back