Pham Duc Minh:
How can I detected market was closed in mql5 code funtion?
Some one know please tell me. Thanks!
Have a look at this function
https://www.mql5.com/en/docs/marketinformation/symbolinfosessiontrade
Documentation on MQL5: Market Info / SymbolInfoSessionTrade
- www.mql5.com
SymbolInfoSessionTrade - Market Info - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
R4tna C #:
Have a look at this function
https://www.mql5.com/en/docs/marketinformation/symbolinfosessiontrade
Thanks for your help. Can you give me a code sample ?
Here is an example
//+------------------------------------------------------------------+ //| 430266-MarketCloseDetect.mq5 | //| Copyright 2022, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2022, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- datetime from; // session beginning time datetime to; // session end time bool result; result = SymbolInfoSessionTrade(_Symbol, MONDAY, 0, from, to); Print(""); PrintFormat ( "SymbolInfoSessionTrade=%-5s [%s %-10s %s %s]", string(result), _Symbol, EnumToString(MONDAY), TimeToString(from, TIME_SECONDS), TimeToString(to, TIME_SECONDS) ); result = SymbolInfoSessionTrade(_Symbol, SUNDAY, 0, from, to); PrintFormat ( "SymbolInfoSessionTrade=%-5s [%s %-10s %s %s]", string(result), _Symbol, EnumToString(SUNDAY), TimeToString(from, TIME_SECONDS), TimeToString(to, TIME_SECONDS) ); } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How can I detected market was closed in mql5 code funtion?
Some one know please tell me. Thanks!