Hi everybody, I used to basket close all the open trades on Friday 23:30 automatically by setting TimeDayOfWeek(TimeCurrent())==5 in my EA.
The problem now is what if today is Thursday and tomorrow Friday is a holiday (off-trading day), is there a command to detect automatically whether a broker's tomorrow is a trading or non-trading day ?
Hope you can advise, thanks
You could periodically, e.g. every minute, open a "far" pending order and delete it immediately again.
If the order failed you can check its status (MARKET CLOSED).
Good luck.
You could periodically, e.g. every minute, open a "far" pending order and delete it immediately again.
If the order failed you can check its status (MARKET CLOSED).
Good luck.
Hi Soewono, thanks.
I'm learning coding now, could you please provide codes how to "convert" the "MARKET CLOSED" of pending order into action ?
As I said, I plan to basket close all open orders on every Friday at 23:30. Presuming there is pending order triggers (pending order's date is next day Friday) on Thursday at 23:29 and the feedback status is "MARKET CLOSED", therefore the EA must execute basket close of all open orders on Thursday at 23:30 instead of Friday (non-trading day), could you please help in codes ? Appreciated ...
No, the MetaTrader system does not convey that type of information. It only provides information on the generalised session times.
Information about any special dates such as holidays or session changes, is usually provided by the broker via an external method, such as emails, push messages or other methods.
No, the MetaTrader system does not convey that type of information. It only provides information on the generalised session times.
Information about any special dates such as holidays or session changes, is usually provided by the broker via an external method, such as emails, push messages or other methods.
There is a possibility if you are working on the EA for MT5. Use the Economic Calendar library to retrieve the events for the week and search for Event Type as CALENDAR_TYPE_HOLIDAY. I suppose it will be as your broker's holidays.
Simpler option will be to store the holidays in a file and check in your code.
Hope one of them works for you.
Cheers,
There is a possibility if you are working on the EA for MT5. Use the Economic Calendar library to retrieve the events for the week and search for Event Type as CALENDAR_TYPE_HOLIDAY. I suppose it will be as your broker's holidays.
Simpler option will be to store the holidays in a file and check in your code.
Hope one of them works for you.
Cheers,
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everybody, I used to basket close all the open trades on Friday 23:30 automatically by setting TimeDayOfWeek(TimeCurrent())==5 in my EA.
The problem now is what if today is Thursday and tomorrow Friday is a holiday (off-trading day), is there a command to detect automatically whether a broker's tomorrow is a trading or non-trading day ?
Hope you can advise, thanks