Random profit in MT5 EA strategy test?

 

Hello Everyone, 

I got a MT5 EA and when I put it to strategy test. I found that it generates random profit sometimes. The EA use the strategy with a random entry by market price that could be controlled by the trade starting time. The EA does not rely on any particular indicator. In this example, the trades were opened at 03:50 (broker time GMT+2, see fig 1). There are four highlighted random profits that were generated at the same time when the trades were opened. I have no clue why this could happen. If I see the random profits, I will change the trades opening time to say 03:45 (see fig 2). Then it again generates a different amount of random profits. Thus I change the time again to say 03:35 (see fig 3), then everything is normal and no random profits at all. I have tried other broker's MT5 system and different type of account either ECN or standard, and it still appear the same situation. 

I was wondering if the EA is not properly coded so it didn't initialized the variables that calculating the profit? Does anyone know what might be the reason of this? 

Thanks for your insight. 


fig 1: trades opened at 03:50, got random profits 

fig 2: trades opened at 03:45, got random profits 

fig 3: trades opened at 03:35, EA works properly, no random profits. 

Files:
fig1.png  91 kb
fig2.png  91 kb
fig3.png  36 kb
 
Look for errors inside the advisor. Always check and log entry conditions. Always check the result of processing a trade request.
 
balupeak:

Hello Everyone, 

I got a MT5 EA and when I put it to strategy test. I found that it generates random profit sometimes. The EA use the strategy with a random entry by market price that could be controlled by the trade starting time. The EA does not rely on any particular indicator. In this example, the trades were opened at 03:50 (broker time GMT+2, see fig 1). There are four highlighted random profits that were generated at the same time when the trades were opened. I have no clue why this could happen. If I see the random profits, I will change the trades opening time to say 03:45 (see fig 2). Then it again generates a different amount of random profits. Thus I change the time again to say 03:35 (see fig 3), then everything is normal and no random profits at all. I have tried other broker's MT5 system and different type of account either ECN or standard, and it still appear the same situation. 

I was wondering if the EA is not properly coded so it didn't initialized the variables that calculating the profit? Does anyone know what might be the reason of this? 

Thanks for your insight. 


fig 1: trades opened at 03:50, got random profits 

fig 2: trades opened at 03:45, got random profits 

fig 3: trades opened at 03:35, EA works properly, no random profits. 

This doesn't appear as random profit but profit considering a price of 0. This is really weird.

1. Which MT5 build are you using ?

2. Can you post the logs ?

3. What testing mode are you using ?

4. Can you post the code or is it private ?

 
Alain Verleyen:

This doesn't appear as random profit but profit considering a price of 0. This is really weird.

1. Which MT5 build are you using ?

2. Can you post the logs ?

3. What testing mode are you using ?

4. Can you post the code or is it private ?

Thank you for the feedback. 

1) MT5 build: 5.00 build 2981, 21 Jun 2021. I believe this is the latest release version. 

2) This is in the strategy test. Thus I saved the journal file in txt as attached. I reproduced the scenario of fig 1 that started at 03:50. Please have a look. 

3) Testing mode: "Every tick based on real ticks", Delay = 10 ms. We could see the details log in the journal file as attached. 

Viewing the log, we could see this line shows:  

"2021.08.22 09:52:23.181 GBPUSD : 2021.01.04 00:00 - 2021.08.14 00:00  real ticks absent for 2 minutes of 230135 total minute bars, every tick generation used" 

Will that be the possible reason? 

That random profits in fig 1 are those for deal 10 (gbpusd), 11 (gbpjpy), 14 (gbpusd) and 15 (gbpjpy) which were gbp related pairs. 

Hopefully, you guys help me identify what kinds of info that listed in the log can shade some lights. 


4) I haven't check with the coder cause the EA was completed 3 month ago. And I hope I could consult with you guys first to see what might be the possible reason before I reach to him.

The coder is usually very busy and and I am afraid the issue might not be taken care efficiently.  The EA works fine in live trading though.

But it just didn't works properly in strategy test that is the annoying parts. For single strategy test, I could always change the trading time until no random profits appeared.

However, when I tried to optimize the EA with multiple parameters then it is very difficult to debug whether the profits is reasonable or not unless I pick it up and run single test. 


Out of curiosity, since you asked about the testing mode and I realized the log that contained this message " GBPUSD : 2021.01.04 00:00 - 2021.08.14 00:00  real ticks absent for 2 minutes of 230135 total minute bars, every tick generation used". 

Thus I changed the testing mode from "Every tick based on real ticks" to "Every tick". Then, guess what, no random profits any more. 

Is this the reason?

Thank you. 

Files:
 
balupeak:

Thank you for the feedback. 

1) MT5 build: 5.00 build 2981, 21 Jun 2021. I believe this is the latest release version. 

2) This is in the strategy test. Thus I saved the journal file in txt as attached. I reproduced the scenario of fig 1 that started at 03:50. Please have a look. 

3) Testing mode: "Every tick based on real ticks", Delay = 10 ms. We could see the details log in the journal file as attached. 

Viewing the log, we could see this line shows:  

"2021.08.22 09:52:23.181 GBPUSD : 2021.01.04 00:00 - 2021.08.14 00:00  real ticks absent for 2 minutes of 230135 total minute bars, every tick generation used" 

Will that be the possible reason? 

No.

That random profits in fig 1 are those for deal 10 (gbpusd), 11 (gbpjpy), 14 (gbpusd) and 15 (gbpjpy) which were gbp related pairs. 

Hopefully, you guys help me identify what kinds of info that listed in the log can shade some lights. 


4) I haven't check with the coder cause the EA was completed 3 month ago. And I hope I could consult with you guys first to see what might be the possible reason before I reach to him.

The coder is usually very busy and and I am afraid the issue might not be taken care efficiently.  The EA works fine in live trading though.

But it just didn't works properly in strategy test that is the annoying parts. For single strategy test, I could always change the trading time until no random profits appeared.

However, when I tried to optimize the EA with multiple parameters then it is very difficult to debug whether the profits is reasonable or not unless I pick it up and run single test. 


Out of curiosity, since you asked about the testing mode and I realized the log that contained this message " GBPUSD : 2021.01.04 00:00 - 2021.08.14 00:00  real ticks absent for 2 minutes of 230135 total minute bars, every tick generation used". 

Thus I changed the testing mode from "Every tick based on real ticks" to "Every tick". Then, guess what, no random profits any more. 

Is this the reason?

Thank you. 

It's really hard to say anything without the code to reproduce. Your EA behaviour is weird, it opens 4 trades on the same symbols in the same ticks apparently (not 100% sure it's the same ticks)...however having the "random" profit seems more like either a real ticks issue or a Strategy Tester issue.

What broker/server are you using ?

 
Alain Verleyen:
No.

It's really hard to say anything without the code to reproduce. Your EA behaviour is weird, it opens 4 trades on the same symbols in the same ticks apparently (not 100% sure it's the same ticks)...however having the "random" profit seems more like either a real ticks issue or a Strategy Tester issue.

What broker/server are you using ?

It is Eightcap Live account server.