1 (edited by Hannes 2017-05-26 00:05:20)

Topic: Bug that results in different backtest results in MT4

Fellow FSB'ers,

I think I've found a bug, which results in different backtesting in FSB and MT4. My EA opens, adds or reduces the same amount at the beginning of each day. So it's basically continually in the market. But it has a stop loss and a take profit, which closes all open positions. Now, in the FSB a take profit was hit, which closed all open orders (4 "units" long), but in the MT4, it didn't close the 4 open long positions (-> screenshot, blue circle, daily chart)



http://i.imgur.com/7LXhMxV.png



I went through the backtest, bar by bar, in MT4 in Every Tick and Control Points mode, watching the stop losses and take profits. That's where I found the bug. Generally, with a "continual" EA, when a new position is opened in MT4, the stop losses and take profits of all open positions are adjusted at the opening of the new position. So all open positions now have the same take profit and stop loss. But in FSB, the point in time, where stop losses and take profits are adjusted, is at the end of the current bar, in which the new position was opened (the image can be enlarged). So if a new position is opened at the beginning of the bar, the stop losses and take profits are not immediately updated, so they can still be hit during that bar.

The day with the blue circle in the screenshot, is a bar where a new position is opened at the beginning of the day and the old take profits are hit later in that day (daily chart), as can be seen on the FSB side in the above screenshot. On the MT4 (left) side, the take profit and stop losses are updated too soon (with the opening of the position at the beginning of the day), so the old take profit isn't hit.

Below it is step by step (on the left side, the old take profit is still in place, on the right side, the opening of the new positions changes the take profit immediately, so the old take profit can't be hit anymore)



http://i.imgur.com/ZrZNxsH.png




This results it quite the distortions over a longer period of time. Please fix it.

Re: Bug that results in different backtest results in MT4

Please attach the strategy for examination.

3 (edited by Hannes 2017-05-26 12:06:42)

Re: Bug that results in different backtest results in MT4

If you could delete it after examination, that would be nice.

Post's attachments

EURUSD_D1_BalanceOfPower.mq4 252.66 kb, 4 downloads since 2017-05-26 

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

Re: Bug that results in different backtest results in MT4

He will need the xml strategy

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Re: Bug that results in different backtest results in MT4

Blaiserboy wrote:

He will need the xml strategy

Why would he? Importing works fine.

Re: Bug that results in different backtest results in MT4

well, ok.... suit yourself.

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Re: Bug that results in different backtest results in MT4

Blaiserboy wrote:

well, ok.... suit yourself.

Is there any difference?

Re: Bug that results in different backtest results in MT4

Yes....
If he has the xml file. he will load it into his computer and run it.... and be able to diagnose the difficulty quickly.....

Using the MT4 file. will be guess work and more time consuming, in most cases.

He will want to track the cause of the discrepancy, not the symptom, and to do that he will want to duplicate the conditions.

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Re: Bug that results in different backtest results in MT4

Dave, you can import the EA file back to a strategy, drag and drop is all what's needed.

10 (edited by Hannes 2017-05-26 18:33:05)

Re: Bug that results in different backtest results in MT4

[deleted by myself]

Re: Bug that results in different backtest results in MT4

Wow, I have forgotten in only three months...

I apologise for that.

When i went on holidays I deleted my portfolios and it seems I have already forgotten how the program works..

Again. I am sorry.

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....