Topic: Discrepancy in EA live trading v backtest

Hi everyone, I have a problem with a live MT4 EA produced from FSBPro. The FSBPro xml file is attached.

It's a 4 hour EURUSD strategy that doesn't produce many trades (this is fine), and I've been trading live in MT4 for about 3-4 weeks. The problem is that the FSBPro backtest produced a Reverse trade (to go long) at 2017-09-06 16:00 - but the live EA on MT4 didn't trigger this signal and continued on its existing short trade.

I manually closed the trade and have suspended the live EA today whilst I investigate.

A few months ago I reported a similar issue on another strategy which turned out to be a faulty indicator https://forexsb.com/forum/topic/6568/gr … -trading/ . Footon very kindly resolved this - I wonder if it's a similar problem?

Many thanks!

Post's attachments

EURUSD 15May17 4hr 3pct SL.xml 10.22 kb, 2 downloads since 2017-06-12 

You don't have the permssions to download the attachments of this post.

Re: Discrepancy in EA live trading v backtest

Indis seem to be OK. Did you run more than one EA simultaneously? What are log files telling? Can you try it in MT tester, the same timespan where the error occurred, what's the behaviour there?

Obvious faults are not visible, pretty hard to nail the reason. Previous trades were perfect?

Re: Discrepancy in EA live trading v backtest

Hi Footon, thanks for looking at it so quickly.

That's good that it sounds like the indicator is behaving properly. It's the only EA running, and the log files don't show anything. I'm not familiar with MT4 backtesting (I read a lot about how rubbish it is, a big reason for buying FSBPro), but I'll try.

One thing that crossed my mind - this strategy keeps the trade open quite a long time (several days/weeks), which means the trade is left open over weekends. During the weekend I've kept MT4 running continuously on the VPS (normally I'd stop/start MT4 on a weekend, which seems to clear it out and do any updates etc). I noticed MT4 did 2-3 build updates when I bounced it yesterday.

Is it best practice to stop/start MT4 over the weekend? What would happen to open trades and EAs if I did this - would the EA resume where it left off when the market re-opens on a Sunday evening? Just wondering if MT4 got itself in a tangle which affected the EA.

Thanks!

Re: Discrepancy in EA live trading v backtest

I don't have experience leaving trades over the weekend, too much of a risk for me. But the developer has assured that the EAs take the trades on from where they left off. I looked the numbers more closely - reversing signal should have been there.

Updates shouldn't mess with trading but you never know with MT (if I remember correctly, the updates are downloaded after start-up and it tends to freeze the platform, quoting stops etc). I would try the tester for that week when reversing signal should have come. If the signal is there (you have to start the tester little bit before the actual trade was opened, then you check if it opens the trade in the same bar and later if it reverses), code works and the problem must lie between the broker and MT.

Re: Discrepancy in EA live trading v backtest

Hi Footon

When I try to backtest on MT4 it crashes MT4 completely. I ask it only to look at the last 3-4 weeks to see what it does at the time of the missed reverse signal on FSBPro.

The following messages are in the Experts log every 4 hours (ie the timeframe of the strategy): "The waiting limit exceeded!" and "Trade context is busy! Waiting..."

Does that give us a clue?

Thanks!

Re: Discrepancy in EA live trading v backtest

Yes, this is better! Might be something with the EA. The developer is more competent with dealing with this issue, but I'll try to have an understanding also.

Re: Discrepancy in EA live trading v backtest

It runs flawlessly on my end, must be something with your platform, what MT build you have?

Re: Discrepancy in EA live trading v backtest

It's MT4 Build 1090 with a date of 19 May 2017.

Re: Discrepancy in EA live trading v backtest

Can you upload the EA file which causes errors?

Re: Discrepancy in EA live trading v backtest

Hi Footon, do you mean the EA4 file - here it is:

Thanks!

Post's attachments

EURUSD 15May17 4hr 3pct SL.mq4 263.96 kb, 2 downloads since 2017-06-18 

You don't have the permssions to download the attachments of this post.

Re: Discrepancy in EA live trading v backtest

Ea works also. It has to be broker/platform specific issue, but given the nature of this error it is very easy to point fingers to the EA code, but it works.

Re: Discrepancy in EA live trading v backtest

Thanks for looking into it Footon, much appreciated.

I think going forward I'll bounce (stop/start) MT4 on weekends, which will apply build updates and clear out any glitches that may build up through running 24/7.

Do you (or anyone) know what happens when MT4 is stopped & started (deliberately or otherwise) whilst an EA is running and a trade is open?

When MT4 restarts does the EA recognise the open trade and just resume where it was before the restart, or does it perhaps produce another trade on top of the previous one?

Maybe it's a topic for another thread? Thanks again!

Re: Discrepancy in EA live trading v backtest

Do you (or anyone) know what happens when MT4 is stopped & started (deliberately or otherwise) whilst an EA is running and a trade is open?

Normally MT remembers the EA settings and when restarts, it loads the same magic number. By doing that, it recognizes the previously opened positions and continue with the expert logic. The position SL and TP are set in the trading server and are active even when your MT terminal is stopped. The worst thing that may happen is that the strategy will not execute potential signals during the offline period.

Re: Discrepancy in EA live trading v backtest

Thank you Mr Popov smile