FX opens 5pm ET Sunday and ends 5pm ET Friday. Some brokers start after (6pm is common/end before (up to 15 minutes) due to low volatility.
Swap is computed 5pm ET. No swap if no open orders at that time.
Brokers use a variety of timezones. Their local time (with or without DST,) GMT/UTC, GMT+2, NY+7.
Only with NY+7 does the broker's 00:00 equals 5pm ET and the start of a daily bar is the start of a new FX day.
GMT brokers, means there is a 1 or 2 hour D1/H4 bar on Sunday (depending on NY DST,) and a short Friday bar.
GMT+2 is close but doesn't adjust for NY DST.
EET is closer except when their DST doesn't match NY's. Last Sunday of March and 1:00 on the last Sunday of October vs second Sunday in March and return at 2:00 a.m. EDT to 1:00 a.m. EST on the first Sunday in November.
Non-NY+7, means the chart daily bar overlaps the start, and converting broker time to NY time requires broker to GMT to NY timezone conversions.
- If you search the web you will find differing answers. Those are all wrong (half the year) because they do not take NY DST into account (or that it changed in 2007 [important when testing history.])
Anyone else with this issue? I'm not referring on GMT time... only want to know if market is open or close for the broker I'm using.
To day that is Saturday DayOfWeek returns 5 (Friday) and TRADE_ALLOWED is true, so i'm thinking to say that if it's Friday(dayofweek==5) and iTime > 23:50 (GMT+2) ... then check patterns as Saturday or Sunday (the last 2 closed candle) if think this could solve not professionally the problem with the date, it's a script not EA...or indicator...
Thank's.
Anyone else with this issue? I'm not referring on GMT time... only want to know if market is open or close for the broker I'm using.
So just ask your broker and write doen the times your broker starts and ends the session.
it is not a broker time problem, no need to ask, i know it start on Sunday at 23.00h GMT+2 and close on Friday at 23h GMT+2
I need to know how in MQL4 how recognize if it's weekend or not, buut if on weekend i receive the last known server datetime... looks impossible...
Thanks
Simo Dodero: I need to know how in MQL4 how recognize if it's weekend or not, buut if on weekend i receive the last known server datetime... looks impossible...
| Asked and answered: "if you receive a tick, the market is open. If you aren't getting ticks, nothing has changed." You don't need to recognize anything. |
Simo Dodero: ok, so how can I check if i'm receiving tick ? some function?
| Perhaps you should read the manual. Event Handling Functions - Functions - Language Basics - MQL4 Reference |
Perhaps you should read the manual. Event Handling Functions - Functions - Language Basics - MQL4 Reference |
ahahah, ok I could use a counter in Ontick to check if I have news incoming ticks, but I wrote it is a script , so it runs only one .
I founded the function TimeLocal() so I can check the time an date of the local real time and compare with TimeCurrent() last known server date and time.
So i use TimeToString with MODE - TIME_MINUTES HH:MM So I can check easily if it's weekend
brokerTime=TimeToString(TimeCurrent(),TIME_MINUTES); //gets result as "hh:mi",
So now I can compare variables and if for the broker it's Friday but TimeLocal > 22:50 (as happend during the weekend) I will use the script to check the current and previous candle.
Thanks everybody !!
ahahah, ok I could use a counter in Ontick to check if I have news incoming ticks, but I wrote it is a script , so it runs only one .
I founded the function TimeLocal() so I can check the time an date of the local real time and compare with TimeCurrent() last known server date and time.
So i use TimeToString with MODE - TIME_MINUTES HH:MM So I can check easily if it's weekend
brokerTime=TimeToString(TimeCurrent(),TIME_MINUTES); //gets result as "hh:mi",
So now I can compare variables and if for the broker it's Friday but TimeLocal > 22:50 (as happend during the weekend) I will use the script to check the current and previous candle.
Thanks everybody !!
Better use TimeToStruct ---> struct https://www.mql5.com/en/docs/constants/structures/mqldatetime
MqlDateTime str1;
TimeToStruct(oracorrente,str1); // gets result as "hh:mi"
Print(str1.hour, str1.day);
Print(TimeCurrent());
Print(TimeLocal());
veladue=1; //usata per reversal puntador 1
vela=0; //pinbar zero attuale
}
So I could check the exactly the hour and date.
Thank's I will check more information about new tick but i dude it works on a script...
- www.mql5.com
- 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 open this post because I was using DayOfWeek but last weekend as it receive the last known server time my script think it was Friday...
I tried to use MarketInfo(TRADE_ALLOWED) but it didn't return me FALSE neither TRUE but if I well remember last weekend it return -1 ??
My script is a simple "Pattern scanner" and it check the last one or 2 last closed candles but when the market is closed or trade is not allowed it must check the actual candle/s. During the week it runs ok but not in the weekend as told before it think it's Friday so it check the candle of Thursday/Wednesday...
Any idea to how to solve this issue ?
Thank You !!