Advertisement
saisri

trend find macd

Oct 22nd, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /*****************************************
  2. KH_MACD
  3. created by KelvinHand in 2012 Oct 6th
  4. MACD Option:
  5. * Classic 2 lines
  6. * MT4 Style
  7.  
  8.  
  9. *****************************************/
  10. _SECTION_BEGIN("KH_MACD");
  11. SetChartBkGradientFill( ParamColor("BgTop", colorBlack),ParamColor("BgBottom", colorBlack), colorBlack);
  12.  
  13. iOpt = ParamList("MACD Option", "Classic|MT4", 1);
  14.  
  15. cMACD = ParamColor("MACD Color", colorWhite);
  16. cSig=ParamColor("Signal color", colorRed );
  17.  
  18.  
  19.  
  20. fastEMA = Param( "Fast EMA", 12, 1, 200, 1 );
  21. slowEMA = Param( "Slow EMA", 26, 1, 200, 1 );
  22. SigSMA = Param( "MACD SMA", 9, 1, 200, 1 );
  23.  
  24. iMACD=EMA(C, fastEMA) - EMA(C,slowEMA);
  25. iSignal=MA(iMACD,SigSMA);
  26.  
  27. Plot( iSignal, "", cSig, styleThick|styleNoLabel);
  28.  
  29.  
  30. _N(Title = StrFormat("MACD(%g, %g, %g) %g, %g", fastEMA, slowEMA, SigSMA, iMacd, iSignal));
  31.  
  32.  
  33. switch (iOpt)
  34. {
  35. case "MT4":
  36. Plot( iMACD, "", cMACD, styleThick|styleHistogram|styleNoLabel);
  37. break;
  38.  
  39. default:
  40. Plot( iMACD, "", cMACD, styleThick|styleNoLabel);
  41. break;
  42.  
  43. }
  44.  
  45. Plot( 0, "", colorGrey40, styleNoLabel);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement