/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Silver
#property indicator_color2 Red

extern int FastEMA = 12;
extern int SlowEMA = 26;
extern int SignalSMA = 9;
double g_ibuf_88[];
double g_ibuf_92[];

int init() {
   SetIndexStyle(0, DRAW_HISTOGRAM);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexDrawBegin(1, SignalSMA);
   IndicatorDigits(Digits + 1);
   SetIndexBuffer(0, g_ibuf_88);
   SetIndexBuffer(1, g_ibuf_92);
   IndicatorShortName("MACD1(" + FastEMA + "," + SlowEMA + "," + SignalSMA + ")");
   SetIndexLabel(0, "MACD");
   SetIndexLabel(1, "Signal");
   return (0);
}

int start() {
   int li_4 = IndicatorCounted();
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4;
   for (int li_8 = 0; li_8 < li_0; li_8++) g_ibuf_88[li_8] = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, li_8) - iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, li_8);
   for (li_8 = 0; li_8 < li_0; li_8++) g_ibuf_92[li_8] = iMAOnArray(g_ibuf_88, Bars, SignalSMA, 0, MODE_EMA, li_8);
   return (0);
}
