If you have a broker that starts its new week session at the same time as the NY-session and you PC-time is set correctly (BUT some symbols like Gold starts at a different time) you can do this (not tested):
if ( Time[0] - Time[1] > 2*24*3600 - 2.5*3600 ) { // weekend time gap with kind of tolerance may be you can add checks of the day of weeks and so on datetime NyOpn = (datetime)(((double)TimeCurrent() + 1800.)/3600.), NyCls = NyOpn + 5*24*3600; // Su.22:00 - Fr.22:00, both are broker time!! int offset = (int)(((double)(TimeCurrent() - TimeGMT()) + 1800.)/3600.); // offset in seconds so just calc: TimeCurrent() - offset; }
It's not tested - check it tonight. (And for backtests it won't work.)
hello
I need to write a function to determine whenever or not the New York session is closed or opened.
I have found many information about the hours of this session in several pages but some of them have different data.
for example, some of them say session is from 1PM to 10PM (GMT). Others say from 12:00PM to 9PM (GMT) in summer and 1:00PM to 10:00PM (GMT) in winter .
I need to know if NY session is closed considering DTS for NY and considering my broker is in GMT+2 (using DTS too). Please note DTS periods are different between NY and my broker location.
thanks and best regards

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hello
I need to write a function to determine whenever or not the New York session is closed or opened.
I have found many information about the hours of this session in several pages but some of them have different data.
for example, some of them say session is from 1PM to 10PM (GMT). Others say from 12:00PM to 9PM (GMT) in summer and 1:00PM to 10:00PM (GMT) in winter .
I need to know if NY session is closed considering DTS for NY and considering my broker is in GMT+2 (using DTS too). Please note DTS periods are different between NY and my broker location.
thanks and best regards