//+------------------------------------------------------------------+ //| Shifted Moving Average.mq5 | //| Copyright 2015, angreeee, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "2015, angreeee and MetaQuotes Software Corp." #property link "https://www.mql5.com/en/users/angreeee" //--- indicator settings #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 Red //--- input parameters input int InpMAPeriod=13; // Period input int InpMAShift=0; // Shift input ENUM_MA_METHOD InpMAMethod=MODE_SMMA; // Method input double shift=0; // Course Shift in PIPS //--- indicator buffers double ExtLineBuffer[]; int precision=1; //+------------------------------------------------------------------+ //| simple moving average | //+------------------------------------------------------------------+ void CalculateSimpleMA(int rates_total,int prev_calculated,int begin,const double &price[]) { int i,limit; //--- first calculation or number of bars was changed if(prev_calculated==0)// first calculation { limit=InpMAPeriod+begin; //--- set empty value for first limit bars for(i=0;i