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 !!
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
Swap is computed 5pm ET. No swap if no open orders at that
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
Non-NY+7, means the chart daily bar overlaps the
start, and converting broker time to NY time requires broker to GMT to NY
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...
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...
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
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
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...