Hi
Pls help to convert attached file (Close and Reverse.mq4) to mq5.
TQ
Pls help to convert attached file (Close and Reverse.mq4) to mq5.
TQ
Attached File(s)
1
Need help on converting mq4 to mq5 1 reply
MQ5 errors converting MT4 to MT5 1 reply
Fractal Adaptive Moving Average - MQ5 to MQ4 6 replies
Any Good Converter from MQ4 to MQ5? 0 replies
Basket Indicators only (mq4 upgrading to MQL5 .mq5) 8 replies
bool IsTradeAllowed( const string symbol, // symbol datetime tested_time // time );
bool IsTradeAllowed(string name, datetime time=0)
{
int i=0;
datetime a,b;
ENUM_DAY_OF_WEEK d;
if(time==0) time=TimeTradeServer();
d=(ENUM_DAY_OF_WEEK)((time/86400+4)%7);
time%=86400;
while(SymbolInfoSessionTrade(name,d,i,a,b))
{
if(time>=a && time<b) return(true);
++i;
}
return(false);
} bool IsTradeAllowed(const string name, datetime time=0)
{
if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) return false; // Terminal AutoTrading
if(!MQLInfoInteger(MQL_TRADE_ALLOWED)) return false; // Program trade permissions
if(!AccountInfoInteger(ACCOUNT_TRADE_ALLOWED)) return false; // Account allowed
ENUM_SYMBOL_TRADE_MODE mode = (ENUM_SYMBOL_TRADE_MODE)SymbolInfoInteger(name, SYMBOL_TRADE_MODE); // Is symbol disabled
if(mode == SYMBOL_TRADE_MODE_DISABLED) return false; // Disabled
if(time==0) time=TimeTradeServer();
// Time must fall within a declared trade session
MqlDateTime dt;
TimeToStruct(time, dt);
ENUM_DAY_OF_WEEK dow = (ENUM_DAY_OF_WEEK)dt.day_of_week; // 0=Sun … 6=Sat
datetime from, to;
for(uint session = 0; ; session++)
{
ResetLastError();
if(!SymbolInfoSessionTrade(name, dow, session, from, to)) // SymbolInfoSessionTrade returns false when no more sessions exist for that day
{
Print("SymbolInfoSessionTrade() failed. Error ", GetLastError());
break;
}
int seconds_now = dt.hour * 3600 + dt.min * 60 + dt.sec; // Session times are seconds-since-midnight; compare against time's time-of-day
if(seconds_now >= (int)from && seconds_now < (int)to)
return true;
}
return false;
} DislikedHi Pls help to convert attached file (Close and Reverse.mq4) to mq5. TQ {file}Ignored
If anything's unclear or you'd like further adjustments — just ask. Happy to help!