Hi, I recently finnished making an EA, tested everything using My [Broker A] account It worked pefectly in both backtests and on a chart. When I try using the EA on a different broker, [Broker B] it does not work, the panel never updates. I don't understand whats causing this. I attached a quick video showing what I explained. Thanks for taking a look
Based on your video, try:
Tools ==> Options ==> Expert Advisors ==> Disable algorithmic trading when the account has been changed. [uncheck, click OK, and restart the terminal].
Based on your video, try:
Tools ==> Options ==> Expert Advisors ==> Disable algorithmic trading when the account has been changed. [uncheck, click OK, and restart the terminal].
New information. It seems a function to check whether or not the market is open is causing the issue. Tho, I don't understand how this can turn into an issue like this, since both charts are forex
bool IsMarketOpen(string symbol, datetime time = 0) { // If no time is provided, use the current time if (time == 0) time = TimeCurrent(); // Get the day of the week for the given time MqlDateTime mqlTime; TimeToStruct(time, mqlTime); ENUM_DAY_OF_WEEK dayOfWeek = (ENUM_DAY_OF_WEEK)mqlTime.day_of_week; if((mqlTime.hour == 23 || mqlTime.hour == 0) && (mqlTime.min > 55 || mqlTime.min < 5)) { return false; } // Loop through all trading sessions for the symbol for (int session = 0; ; session++) { datetime sessionStart, sessionEnd; bool isSession = SymbolInfoSessionTrade(symbol, dayOfWeek, session, sessionStart, sessionEnd); // If no more sessions exist, the market is closed if (!isSession) return false; // Convert session times to seconds since midnight MqlDateTime sessionStartStruct, sessionEndStruct; TimeToStruct(sessionStart, sessionStartStruct); TimeToStruct(sessionEnd, sessionEndStruct); int sessionStartSeconds = sessionStartStruct.hour * 3600 + sessionStartStruct.min * 60 + sessionStartStruct.sec; int sessionEndSeconds = sessionEndStruct.hour * 3600 + sessionEndStruct.min * 60 + sessionEndStruct.sec; // Convert the current time to seconds since midnight int currentSeconds = mqlTime.hour * 3600 + mqlTime.min * 60 + mqlTime.sec; // Check if the current time falls within the session if (currentSeconds >= sessionStartSeconds && currentSeconds <= sessionEndSeconds) return true; } // Default return (market is closed) return false; }
I downloaded tradesessions.mqh from the forum a while ago. It works pretty well:
TRADE_SESSIONS TradeSession(_Symbol); bool MarketOpen = TradeSession.isSessionTrade(TimeCurrent());
New information. It seems a function to check whether or not the market is open is causing the issue. Tho, I don't understand how this can turn into an issue like this, since both charts are forex
If you want to specify daily trading times without regard to weekdays, here's a simple time filter:
Forum on trading, automated trading systems and testing trading strategies
Issues with TimeHour Error when Coding EA
Ryan L Johnson, 2025.01.30 15:16
Inputs:
input group "---------------------------------------"; input group "Turn trading time filter on/off"; input bool UseTimer = true; input group "---------------------------------------"; input group "Use personal computer time to filter? ==> if false, broker time is used"; input bool UsePCtime = true; input group "---------------------------------------"; input group "Set time to enable trading ==> Intraday and overnight are supported"; input string StartTime = "21:00"; input group "---------------------------------------"; input group "Set time to disable trading"; input string StopTime = "16:00"; input group "---------------------------------------";
Variables on global scope:
datetime dLocalTime, dStartTime, dStopTime; ulong uLocalTime, uStartTime, uStopTime,
In OnTick():
dStartTime = StringToTime(StartTime); uStartTime = ulong(dStartTime); dStopTime = StringToTime(StopTime); uStopTime = ulong(dStopTime); if(UsePCtime == true) { dLocalTime = TimeLocal(); } else { dLocalTime = TimeCurrent(); } uLocalTime = ulong(dLocalTime); if(uStartTime < uStopTime) // intraday start trading time is earlier than intraday stop trading time { if(UseTimer == true) { if(uLocalTime >= uStartTime && uLocalTime < uStopTime) { runBot = true; if(timerPrinted != 1) { Print("Timer is ON. Current time is within set trading times. Bot is ON."); timerPrinted = 1; } } else { runBot = false; if(timerPrinted != 2) { Print("Timer is ON. Current time is outside of set trading times. Bot is OFF."); CancelOrder(); timerPrinted = 2; } } } } if(uStartTime > uStopTime) // intraday start trading time is later than intraday stop trading time { if(UseTimer == true) { if(uLocalTime >= uStopTime && uLocalTime < uStartTime) { runBot = false; if(timerPrinted != 2) { Print("Timer is ON. Current time is outside of set trading times. Bot is OFF."); timerPrinted = 2; } } else { runBot = true; if(timerPrinted != 1) { Print("Timer is ON. Current time is within set trading times. Bot is ON."); timerPrinted = 1; } } } } if(UseTimer == false) { runBot = true; if(timerPrinted != 3) { Print("Timer is OFF. Bot is ON."); timerPrinted = 3; } }
And then put your trading code inside:
if(runBot == true) { //all of your trading code }(I prefer to leave trade exits code outside of the time filter).
different brokers use a different filling...and nobody seems to set request.type_filling to the correct filling
You should reveal the part of the code where you execute orders. I bet you're using the request structure

- 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, I recently finnished making an EA, tested everything using My [Broker A] account It worked pefectly in both backtests and on a chart. When I try using the EA on a different broker, [Broker B] it does not work, the panel never updates. I don't understand whats causing this. I attached a quick video showing what I explained. Thanks for taking a look