//+------------------------------------------------------------------+ //| vaMA| //| Copyright 2013, J.B| //+------------------------------------------------------------------+ #property copyright "Copyright © 2013, J.B" #property version "1.00" #include #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrRoyalBlue #property indicator_width1 3 #property indicator_label1 "vaMA" input int vaMA_period=15; input bool use_double_smooth=1; double vaMA_buffer[],EMA[]; //+------------------------------------------------------------------+ //| vaMA initialization function | //+------------------------------------------------------------------+ void OnInit() { SetIndexBuffer(0,vaMA_buffer,INDICATOR_DATA); SetIndexBuffer(1,EMA,INDICATOR_CALCULATIONS); } //+------------------------------------------------------------------+ //| vaMA 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_total