//+------------------------------------------------------------------+ //| vaMACl| //| Copyright 2013, J.B| //+------------------------------------------------------------------+ #property copyright "Copyright © 2013, J.B" #property version "1.00" #include #property indicator_chart_window #property indicator_buffers 3 #property indicator_plots 1 #property indicator_type1 DRAW_COLOR_LINE #property indicator_color1 clrGray,clrRoyalBlue,clrOrange #property indicator_style1 STYLE_SOLID #property indicator_width1 3 #property indicator_label1 "vaMACl" input int vaMA_period=15; input bool use_double_smooth=1; double vaMA_buffer[],vaMA_Color_buffer[],EMA[]; //+------------------------------------------------------------------+ //| vaMACl initialization function | //+------------------------------------------------------------------+ void OnInit() { SetIndexBuffer(0,vaMA_buffer,INDICATOR_DATA); SetIndexBuffer(1,vaMA_Color_buffer,INDICATOR_DATA); SetIndexBuffer(2,EMA,INDICATOR_CALCULATIONS); } //+------------------------------------------------------------------+ //| vaMACl iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total,const int prev_calculated,const int begin,const double &price[]) { int first,bar; double vel,acc,aaa; ExponentialMAOnBuffer(rates_total,prev_calculated,begin,vaMA_period,price,EMA); //Generate EMA from price if(rates_totalvaMA_buffer[bar]) vaMA_Color_buffer[bar]=2; // } // return(rates_total); } //+------------------------------------------------------------------+