//+------------------------------------------------------------------+ //| InBarMtfAlert_v1.mq4 | //| Copyright © 2011, Snail09 | //| http://www.mql4.com/ru/users/Snail09 | //| 30.11.2011 | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011, Snail09" #property link "http://www.mql4.com/ru/users/Snail09" #property indicator_buffers 7 #property indicator_color1 Magenta #property indicator_color2 Magenta #property indicator_color3 DarkKhaki #property indicator_color4 DarkKhaki #property indicator_color5 Blue #property indicator_color6 Blue #property indicator_color7 DarkKhaki #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 1 #property indicator_width4 1 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 1 // Количество свечей эмулирующих старший, возможно нестандартный ТФ extern int TF=15; // Количество свечей старшего ТФ, среди которых ищется внутренняя свеча extern int NR = 4; // Использование алерта. extern bool UseAlert = false; // Массивы для максимумов и минимумов старшего ТФ, а также диапазонов double val1[],val2[],val3[],val4[],val5[],val6[],val7[]; double Max[],Min[],Diapazon[]; #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,val1); SetIndexBuffer(1,val2); SetIndexBuffer(2,val3); SetIndexBuffer(3,val4); SetIndexBuffer(4,val5); SetIndexBuffer(5,val6); SetIndexBuffer(6,val7); SetIndexStyle(0,DRAW_ARROW); SetIndexStyle(1,DRAW_ARROW); SetIndexStyle(2,DRAW_LINE); SetIndexStyle(3,DRAW_LINE); SetIndexStyle(4,DRAW_SECTION); SetIndexStyle(5,DRAW_SECTION); SetIndexStyle(6,DRAW_LINE,STYLE_DOT); SetIndexArrow(0,158); SetIndexArrow(1,158); SetIndexEmptyValue(0,EMPTY_VALUE); SetIndexEmptyValue(1,EMPTY_VALUE); SetIndexEmptyValue(2,EMPTY_VALUE); SetIndexEmptyValue(3,EMPTY_VALUE); SetIndexEmptyValue(4,EMPTY_VALUE); SetIndexEmptyValue(5,EMPTY_VALUE); SetIndexEmptyValue(6,EMPTY_VALUE); SetIndexLabel(0,"Hi"); SetIndexLabel(1,"Low"); ArrayResize(Max,NR); ArrayResize(Min,NR); ArrayResize(Diapazon,NR); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //WindowRedraw(); static datetime PrevTime=0; // Время открытия предпоследнего бара if(PrevTime==0) PrevTime=Time[0]; // При первом запуске текущий бар пропускаем int limit; int counted_bars=IndicatorCounted(); if(counted_bars==0) limit=Bars-TF*NR; if(counted_bars<0) return(-1); if(counted_bars>0) limit=Bars-counted_bars; limit--; ArrayInitialize(val1,EMPTY_VALUE); ArrayInitialize(val2,EMPTY_VALUE); for(int i=limit;i>=0;i--) { int shift=i; for(int j=0; jMin[1])&&(Diapazon[0]<=Diapazon[ArrayMinimum(Diapazon)])) { for(int k=1; kPrevTime) // 1 раз на бар выводим алерт if((val1[1]!=EMPTY_VALUE)&&(val2[1]!=EMPTY_VALUE)) Alert("TF=",TF," NR=",NR); } PrevTime=Time[0]; // Запоминаем время открытия нулевого бара*/ } return(0); } //+------------------------------------------------------------------+