Exluding Weekends & Hoildays in Calculating Time Difference

 

Hi,


How to exclude weekends and holiday in calculating many sets of time differences between two dates?

Please help

 
There is nothing to exclude. You assume every bar every exists — they don't. What if there are no ticks during a specific candle period? There can be minutes between ticks during the Asian session, think M1 chart. Larger charts, think weekend, market holiday (country and broker specific.) requires knowledge of when your broker stops and starts (not necessary the same as the market.)
          "Free-of-Holes" Charts - MQL4 Articles
          No candle if open = close ? - MQL4 programming forum
 

How to achieve this incorporating a set of  coding into the indicator?

 
chua le: How to achieve this

Achieve what? There are no mind readers here and our crystal balls are cracked.

 

Hi,


I dont quite understand the concept you are talking about.

 
extern int     TimeStartModay = 0;       //Time to start trade moday
extern int     TimeStopFriday = 23;      //Time to stop trade friday
bool RunIndicators;
int start()
{
RunIndicators=true;
if(((DayOfWeek()==1)&&(TimeHour(TimeCurrent())>=TimeStartModay))||((DayOfWeek()==5)&&(TimeHour(TimeCurrent())<=TimeStopFriday))) RunIndicators=false;

.......


return(0);
}

I refer to this code from Nikos. https://www.mql5.com/en/forum/138953 and put it into my code but it doesnt solved my issue.


please advise.

How to account for weekend time?
How to account for weekend time?
  • 2012.04.11
  • www.mql5.com
I need some help to account for weekend time. I am writing a script that keeps track of time trades are open...
Reason: