Topic: backtesting result is different from the real trading

Hi experts,

I have found some problem after using portfolio EA created by the studio. The backtesting result is different from the real trading result. (I tested it by using every tick model mode and the same historical data.)

Please see the following image, the number of opening position of both is not equal.
At 11:00, the strategy tester opened 27 positions but the real account only opened 10 positions.

real
https://www.picz.in.th/images/2018/07/04/N9v08n.th.png
tester
https://www.picz.in.th/images/2018/07/04/N9vio0.png

I think this event causes the EA's performance decreases and also leads to lost opportunity of making profits.
Anyone know Why? and How to fix it.
Thank very much

Re: backtesting result is different from the real trading

We need more info in order to examine the problem. Please check the logs for some suspicious messages. Place indicators on the chart and check if the trades are on the correct places. At least you will find out if the difference comes from the entries or from the exits. Currently we cannot see anything on these screens. If you cannot figure it out what it happens, please post screenshots of the indicators charts and the strategy rules.

Re: backtesting result is different from the real trading

Did you run multiple EAs on your account?

Most brokers have maximum number of open trades policy. It may prevent you to open additional positions.

Don't keep calm, it's time to trade

Re: backtesting result is different from the real trading

No, I only run 1 portfolio ea that consists of 100 strategies.
My broker has the maximum number of open positions is 100. It's not possible exceeding

I will collect the more information and then present you soon.
thank you

Re: backtesting result is different from the real trading

Hi, experts

The following link is site tracking my demo account.
please focus on the position that opens 2 July 2018
https://www.fxblue.com/users/moonsky2 (PIN = forexsb)

I compared the position 1 by 1 between demo and tester, found that both have the different number of position, furthermore their close time is very different.
you will see the demo account has loss more than the tester I set spread at 15, even though I use ECN account low spread.

https://www.dropbox.com/s/e5troxogogbsxyb/1.xls?dl=0


Thank very much

Post's attachments

Portfolio Expert GBPUSD M30.mq4 223.44 kb, 10 downloads since 2018-07-05 

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

Re: backtesting result is different from the real trading

moonsky wrote:

Hi, experts

The following link is site tracking my demo account.
please focus on the position that opens 2 July 2018
https://www.fxblue.com/users/moonsky2 (PIN = forexsb)

I compared the position 1 by 1 between demo and tester, found that both have the different number of position, furthermore their close time is very different.
you will see the demo account has loss more than the tester I set spread at 15, even though I use ECN account low spread.

https://www.dropbox.com/s/e5troxogogbsxyb/1.xls?dl=0


I am thinking the problem is slippage, the demo's open time always opens position lag than tester about 4-5 seconds.
my ping in mt4 is 10-20  approximately,

may I suggest something, If we have the indicator that compares the open price between the price that the bar was born (TF H1 12:00:00) and the price was opened in real trade. There is the parameter such the percent change more than x% the real position will not open.


Thank very much

Re: backtesting result is different from the real trading

Do demo and tester have same start time?

Don't keep calm, it's time to trade

8 (edited by moonsky 2018-07-06 11:08:07)

Re: backtesting result is different from the real trading

yonkuro wrote:

Do demo and tester have same start time?

Yes they do

Re: backtesting result is different from the real trading

Here is my observation

Strategies with significant difference in closing
Number 46. Closing indicators: Standard Deviation
Number 95. Closing indicators: MACD (not recommended to use)

Strategies that didn't open trades
Number 0. Opening indicators: Volumes, RVI
Number 7. Opening indciators: Stochastic, Standard Deviation

Please correct me if i'm wrong.

I think we need to investigate the indicators behavior too.

Don't keep calm, it's time to trade

10 (edited by yonkuro 2018-07-06 23:35:31)

Re: backtesting result is different from the real trading

I'm afraid the indicators might be repainting.

Don't keep calm, it's time to trade

Re: backtesting result is different from the real trading

I forgot to give info that I started to use this portfolio EA on 28 June 2018
before using I already closed all of the old position.

12

Re: backtesting result is different from the real trading

If they are standard indicators of MT4 "How" to repaint?

13 (edited by yonkuro 2018-07-07 09:33:41)

Re: backtesting result is different from the real trading

GD wrote:

If they are standard indicators of MT4 "How" to repaint?

Yes you're right,

Once the bar is fully formed the indicator shouldn't repaint, except for fractal and zigzag, I think that's why Popov exclude them from EA Studio.

Now I'm stuck, I can't think any other reason.

Don't keep calm, it's time to trade

Re: backtesting result is different from the real trading

maybe cause of Ontick mode?

Is it possible? If change it to Ontimer, the open time and close time will have more accuracy.

15 (edited by GD 2018-07-07 13:07:47)

Re: backtesting result is different from the real trading

Hi Moonsky

What happens if you run EAs 46, 95,0 ,7 one by one without portfolio in metatester?
Do you have problems?

Re: backtesting result is different from the real trading

GD wrote:

Hi Moonsky

What happens if you run EAs 46, 95,0 ,7 one by one without portfolio in metatester?
Do you have problems?

Hi
you can download the result the following url.
https://www.dropbox.com/sh/z4huxdtj04rd … wKVza?dl=0

All ea have no error occurs in journal tab.

17 (edited by GD 2018-07-07 17:10:30)

Re: backtesting result is different from the real trading

Did you check  results of open and close positions of EA Studio and Metatester?
If they are the same, then the problem cannot be in mistake of indicators.
It must be in brokers side. Maybe to use 50+50 EAs? two portfolio?
maybe a change to WAIT State parameter in protfolio EA mq4... also

Re: backtesting result is different from the real trading

Hi GD,

Do you think a widening spread can affect the indicators value?

Regards.

Don't keep calm, it's time to trade

19 (edited by GD 2018-07-08 01:15:00)

Re: backtesting result is different from the real trading

If a problem like that exist then a wider spread will result to do not open or close trades at specific time because the orders cannot be executed (normally).
if others trades executed at the same time (bar open ) for same currency, TF, then you cannot say spread is the only reason.
Each indicator used in one strategy has its own sensitivity. So, if it is high then we can see open or close at later time or see no trade.
So how can we fix that? By using an extra indicator or same indicator with slightly different parameter. Ofcource can be better ways.
Possibly if an order cannot be executed at specific time (bar open) can give an output in a file or journal... so we can monitor better broker's involvement or our problems.

20 (edited by moonsky 2018-07-08 07:20:36)

Re: backtesting result is different from the real trading

GD wrote:

Did you check  results of open and close positions of EA Studio and Metatester?
If they are the same, then the problem cannot be in mistake of indicators.
It must be in brokers side. Maybe to use 50+50 EAs? two portfolio?
maybe a change to WAIT State parameter in protfolio EA mq4... also

Hi
I checked it. Their result has some difference. some are very close.
I added the result to my dropbox, you can download from the previous link.

I am pretty sure that ping in the mt4 lead to high slippage.
From this picture, It comes from another one. The right side is open time column. strategy number 14 's Trading rule is  Entry at Hour = 0 (Day opening). you will see it lag more than a minute some has 5-10 minutes.
https://s15.postimg.cc/6o0hw9b6v/image.png

But no matter how much the ping has, I won't believe that it causes more than 1 minute lag time of open time.

thank for helping

21 (edited by GD 2018-07-08 07:19:02)

Re: backtesting result is different from the real trading

Find this code in mq4

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bool IsTradeContextFree()
  {
   if(IsTradeAllowed())
      return (true);

   uint startWait=GetTickCount();
   Print("Trade context is busy! Waiting...");

   while(true)
     {
      if(IsStopped())
         return (false);

      uint diff=GetTickCount()-startWait;
      if(diff>30*1000)
        {
         Print("The waiting limit exceeded!");
         return (false);
        }

      if(IsTradeAllowed())
        {
         RefreshRates();
         return (true);
        }
      Sleep(TRADE_RETRY_WAIT);
     }
   return (true);
  }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Maybe you need to change 30 to 90???

Also, try to play with

#define TRADE_RETRY_COUNT 4
#define TRADE_RETRY_WAIT  100

Re: backtesting result is different from the real trading

Thank GD

Could you tell me? what does the meaning of the number?
and the effect if it is changed.

23

Re: backtesting result is different from the real trading

30x1000 milliseconds= 30 seconds

define TRADE_RETRY_WAIT  100
100 =milliseconds

Re: backtesting result is different from the real trading

Hi Moonsky, may I ask what broker you are using? Apologies if it's somewhere in your logs but I'm viewing on my mobile.

I'm facing the same issue and I'm inclined to blame it on my broker...

Re: backtesting result is different from the real trading

ivo.carola wrote:

Hi Moonsky, may I ask what broker you are using? Apologies if it's somewhere in your logs but I'm viewing on my mobile.

I'm facing the same issue and I'm inclined to blame it on my broker...


Hi

I used pepper... broker

Sorry for reply lately