bool CheckTradeAllowed() { MqlDateTime date_cur; TimeTradeServer(date_cur); datetime seconds_cur = date_cur.hour * 3600 + date_cur.min * 60 + date_cur.sec; int i = 0; while(true) { datetime seconds_from = {}, seconds_to = {}; if(!SymbolInfoSessionTrade(Symbol(), (ENUM_DAY_OF_WEEK)date_cur.day_of_week, i, seconds_from, seconds_to)) break; if(seconds_cur > seconds_from && seconds_cur < seconds_to) return true; ++i; } return false; }
Home
Checking
Function
Market
MetaTrader 5 Script
Whether
MetaTrader 5 Script | Function for checking whether the market is open for trading at the moment by the current symbol
MetaTrader 5 Script | Function for checking whether the market is open for trading at the moment by the current symbol
Subscribe to:
Post Comments (Atom)