#property copyright "4kk4" #property link "https://www.mql5.com/en/users/4kk4" #property description "KG Moving Average" //--- indicator settings #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 Red #property indicator_width1 2 //--- input parameters input ENUM_TIMEFRAMES InpTimeFrame = PERIOD_CURRENT; // Timeframe Terapan input int InpMAPeriod = 60 ; // Period input int InpMAShift = 0; // Shift input ENUM_MA_METHOD InpMAMethod = MODE_SMA ; // Method input ENUM_APPLIED_PRICE InpMAPrice= PRICE_CLOSE ; // Method //--- indicator buffers double ExtLineBuffer[]; int MAPeriod; //= PeriodSeconds(InpMAPeriod) / (PeriodSeconds() ); // Period //+------------------------------------------------------------------+ //| 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=MAPeriod+begin; //--- set empty value for first limit bars for(i=0;i