//+------------------------------------------------------------------+ //| Custom Moving Average Levels.mq5 | //| Copyright © 2017, Vladimir Karputov | //| http://wmua.ru/slesar/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2017, Vladimir Karputov" #property link "http://wmua.ru/slesar/" #property version "1.000" #property description "Standart Moving Average and two levels" //--- indicator settings #property indicator_chart_window #property indicator_buffers 3 #property indicator_plots 3 #property indicator_type1 DRAW_LINE #property indicator_style1 STYLE_DOT #property indicator_color1 clrGray #property indicator_label1 "UP" #property indicator_type2 DRAW_LINE #property indicator_color2 clrRed #property indicator_label2 "Middle" #property indicator_type3 DRAW_LINE #property indicator_style3 STYLE_DOT #property indicator_color3 clrGray #property indicator_label3 "Down" //--- input parameters input int InpMAPeriod=13; // Period input int InpMAShift=0; // Shift input ENUM_MA_METHOD InpMAMethod=MODE_SMMA; // Method input int InpLevelUp=100; // Level Up (in pips) input int InpLevelDown=-100; // Level Down (in pips) //--- indicator buffers double ExtLineBufferUp[]; double ExtLineBufferMiddle[]; double ExtLineBufferDown[]; //--- double ExtInpLevelUp=0.0; double ExtInpLevelDown=0.0; //+------------------------------------------------------------------+ //| 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