//+------------------------------------------------------------------+ //| Session.mq5 | //| Copyright 2010, Urain | //| https://login.mql5.com/ru/users/Urain | //+------------------------------------------------------------------+ #property copyright "Copyright 2010, Urain" #property link "https://login.mql5.com/ru/users/Urain" #property version "1.00" #property indicator_separate_window #property indicator_buffers 6 #property indicator_plots 3 //--- plot1 #property indicator_label1 "Asia" #property indicator_type1 DRAW_FILLING #property indicator_color1 clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot2 #property indicator_label2 "Europa" #property indicator_type2 DRAW_FILLING #property indicator_color2 clrBlue #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- plot3 #property indicator_label3 "USA" #property indicator_type3 DRAW_FILLING #property indicator_color3 clrGreen #property indicator_style3 STYLE_SOLID #property indicator_width3 1 double Asia_Up[]; double Asia_Down[]; double Europa_Up[]; double Europa_Down[]; double USA_Up[]; double USA_Down[]; MqlDateTime dt_struct; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,Asia_Up,INDICATOR_DATA); SetIndexBuffer(1,Asia_Down,INDICATOR_DATA); SetIndexBuffer(2,Europa_Up,INDICATOR_DATA); SetIndexBuffer(3,Europa_Down,INDICATOR_DATA); SetIndexBuffer(4,USA_Up,INDICATOR_DATA); SetIndexBuffer(5,USA_Down,INDICATOR_DATA); //--- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- for(int i=prev_calculated;i0 && dt_struct.hour<10) {Asia_Up[i]=8.; Asia_Down[i]=5.;} else{Asia_Up[i]=EMPTY_VALUE; Asia_Down[i]=EMPTY_VALUE;} if(dt_struct.hour>8 && dt_struct.hour<18) { Europa_Up[i]=6.; Europa_Down[i]=3.;} else{ Europa_Up[i]=EMPTY_VALUE; Europa_Down[i]=EMPTY_VALUE;} if(dt_struct.hour>14 && dt_struct.hour<22) {USA_Up[i]=4.; USA_Down[i]=1.;} else{USA_Up[i]=EMPTY_VALUE; USA_Down[i]=EMPTY_VALUE;} } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+