//+------------------------------------------------------------------+ //| MA_Open_V0.mq4 | //| Yuriy Tokman | //| yuriytokman@gmail.com | //+------------------------------------------------------------------+ #property copyright "Yuriy Tokman" #property link "yuriytokman@gmail.com" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red extern string __настройки_нидикатора__ = "Здесь изменяем"; extern int PeriodMA = 33; extern int ma_method = 1;//0-3 extern int applied_price = 6;//0-6 extern int верхний_порог = 250; extern int нижний_порог = 250; double ExtMapBuffer0[]; double ExtMapBuffer1[]; datetime LastTime=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,3); SetIndexBuffer(0,ExtMapBuffer0); SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,3); SetIndexBuffer(1,ExtMapBuffer1); IndicatorShortName("MA_Open ("+PeriodMA+")"); SetIndexLabel(0," ISQ#481971287 "); SetIndexLabel(1," yuriytokman@gmail.com "); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; if(counted_bars==0) limit--; for(int i=limit; i>=0; i--) { double MA_0 = iMA( NULL,0,PeriodMA,0,ma_method,applied_price,i); double MA_H = MA_0 + верхний_порог*Point; double MA_L = MA_0 - нижний_порог*Point; if(Open[i]>MA_H&&Low[i]>MA_0&&Low[i]MA_L) { if(Time[0]!= LastTime) { Alert("откат для селл "," Символ ",Symbol()," Период ",GetNameTF()); LastTime = Time[0]; } ExtMapBuffer1[i]=-1; } else ExtMapBuffer1[i]=0; } //---- return(0); } //+------------------------------------------------------------------+ string GetNameTF(int TimeFrame=0) { if (TimeFrame==0) TimeFrame=Period(); switch (TimeFrame) { case PERIOD_M1: return("M1"); case PERIOD_M5: return("M5"); case PERIOD_M15: return("M15"); case PERIOD_M30: return("M30"); case PERIOD_H1: return("H1"); case PERIOD_H4: return("H4"); case PERIOD_D1: return("Daily"); case PERIOD_W1: return("Weekly"); case PERIOD_MN1: return("Monthly"); default: return("UnknownPeriod"); } }