//+------------------------------------------------------------------+ //| 3FoldTradingHours.mq4 | //| cubesteak | //| http://www.cubesteak.net | //+------------------------------------------------------------------+ #property copyright "cubesteak" #property link "http://www.cubesteak.net" #property indicator_chart_window //---- input parameters extern int FromHourTrade1=-1; extern int ToHourTrade1=-1; extern int FromHourTrade2=-1; extern int ToHourTrade2=-1; extern int FromHourTrade3=-1; extern int ToHourTrade3=-1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //---- int a,b,c; bool UseHourTrade = true; if (UseHourTrade) { if ( FromHourTrade1==-1 && ToHourTrade1==-1 && FromHourTrade2==-1 && ToHourTrade2==-1 && FromHourTrade3==-1 && ToHourTrade3==-1 ) Comment("Trading Hours Not Set"); else { int now = Hour(); if ( ( (now>=FromHourTrade1) ) && ( (now<=ToHourTrade1) ) ) a=1; if ( ( (now>=FromHourTrade2) ) && ( (now<=ToHourTrade2) ) ) b=1; if ( ( (now>=FromHourTrade3) ) && ( (now<=ToHourTrade3) ) ) c=1; if ( (a!=1) && (b!=1) && (c!=1) ) { Comment( "\n"," ^^^^^^^^^^^^^^^^^^^^", "\n"," * NON-TRADING HOURS * ", "\n"," ^^^^^^^^^^^^^^^^^^^^"); } else Comment( "\n"," ^^^^^^^^^^^^^^^^", "\n"," * TRADING HOURS * ", "\n"," ^^^^^^^^^^^^^^^^"); } } //---- return(0); } //+------------------------------------------------------------------+