back test on MT5 ?

 

Hi

I want to work back test99% accurately on MT5 platform.

But I don't know if it's enough to do it directly on MT5 platform? Or should we use other programs like (Tickstory).

I mean, Can we believe 99% accuracy results when doing back test directly on the platform or should we use other programs to get 99% accuracy ?

Thanks

 

We can use "every tick based on real ticks" mode in Metatrader 5, and it will be the same as we are trading on the broker's data:
This is the article: Testing trading strategies on real ticks
some more -

----------------

You can look at ASCTREND SYSTEM summary where I backtested public EA using this "every tick based on real ticks" mode in Metatrader 5 (the post #81):




Testing trading strategies on real ticks
Testing trading strategies on real ticks
  • www.mql5.com
The article provides the results of testing a simple trading strategy in three modes: " 1 minute OHLC " using only Open, High, Low and Close prices of minute bars; detailed modeling in " Every tick " mode, as well as the most accurate " Every tick based on real ticks " mode applying actual historical data. Comparing the results allows us to...
 
Sergey Golubev:

We can use "every tick based on real ticks" mode in Metatrader 5, and it will be the same as we are trading on the broker's data:
This is the article: Testing trading strategies on real ticks
some more -

----------------

You can look at ASCTREND SYSTEM summary where I backtested public EA using this "every tick based on real ticks" mode in Metatrader 5 (the post #81):




Thanks for replay.

I have another question please.

On MT5 platform, Why is there a big difference in results between backtest and trading on the demo account?

Look at the next picture; I did back test directly on the MT5 platform It's result for 100% accuracy.


And Look at the next picture; it’s the result of the trading on the demo account.


There's obviously a big difference between the two previous pictures, I don't know why?

Please note:

1- I used the same broker and same parameters.

2- There are no errors in the journal.

3- I put the latency in the back test = 150ms, and the latency for platform trading on the demo account = 150ms. That means there's no difference in the speed of execution.

So, Why is this so much a difference between the result of the back test and the trade on the demo account even though the accuracy of the back test = 100%?

 
Robin:
...

So, Why is this so much a difference between the result of the back test and the trade on the demo account even though the accuracy of the back test = 100%?

Is it MT5?
Did you backtest with "every tick based on real ticks" mode in Metatrader 5? And is it different from the trading for exact same period?
From 3rd of June till 8th of July from about 3,000 dollars to 368,428? MT5? More than 300,000 dollars in profit for 1 month starting with 3,000?
It is really something wrong with your EA (bug in your EA).

Because "every tick based on real ticks" mode in Metatrader 5 is same as you are trading (real broker's data is used in this mode).
For example:

  • if you backtest in MT5 with "every tick based on real ticks" mode in Metatrader 5 and having different results from real trading so it is very strange/abnormal case for MT5;
  • if you backtest in MT4 and having different results from real trading on MT4 so it is norma for MT4.

It depends on when the trading and backtesting were started (same hours/minutes), which strategy was coded inside EA, and more.
But if backtesting with "every tick based on real ticks" mode MT5 is different from trading so it is abnormal case. But it is normal case if the backtesting is different from trading in MT4.

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
The idea of ​​automated trading is appealing by the fact that the trading robot can work non-stop for 24 hours a day, seven days a week. The robot does not get tired, doubtful or scared, it's is totally free from any psychological problems. It is sufficient enough to clearly formalize the trading rules and implement them in the algorithms, and...
 

But it is just my opinion only.
I am in forex since last century, and I can believe in backtesting if I know how EA was coded and which manual trading strategy was used to be inside this EA.

If EA was coded in classical way (no martingale, no tick scalping, one trade per chart, and so on) so backtesting with "every tick based on real ticks" mode in Metatrader 5 should be same as trading for this period of time with same condition/data/spread/etc.

----------------

It was one thread in Russian forum where the coders were discussing some part of codes: which codes should be inserted to the losing EA if we want to show good backtesting results (from 1,000 to few millions for 1 month). It was for MT4 in that time.
Because it is difficult to get this "few millions" bug ... it is necessary to know how to code it.
:)


The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
The idea of ​​automated trading is appealing by the fact that the trading robot can work non-stop for 24 hours a day, seven days a week. The robot does not get tired, doubtful or scared, it's is totally free from any psychological problems. It is sufficient enough to clearly formalize the trading rules and implement them in the algorithms, and...
 
  • "Can someone help me to find the error in my "holy grail"? - forum thread (MT4)
  • "I look at these graphs and I feel better and better" - forum thread (MT4)
thankfull holy grail
thankfull holy grail
  • 2015.11.29
  • www.mql5.com
I present you guys.... the holy grail......tataaaaa no...just joking. this is a crappy EA that converts 900 USD into 4.000...
 
Sergey Golubev:
  • Can someone help me to find the error in my "holy grail"? - forum thread (MT4)
  • "I look at these graphs and I feel better and better" - forum thread (MT4)

Thanks Sergey.

My previous post just meant about MT5, And also the pictures attached to my previous post were just on MT5 platform.

And Yes, my back tests in MT5 platform and used mode (real ticks).

Note, This expert has been converted from MQ4 to MQ5.

In MT4 platform:

1- I worked back test with 99.90% accuracy and the result was the loss of all the account.

2- I tried it on the demo account and the result was the loss of all the account.

After converting  to MT5:

1- I worked back test directly on mt5 with 100% accuracy and the result was a big profit.

2- I tried it on the demo account and the result was the loss of all the account.

On MT5 (I mean, Now I'm just going to talk about MT5):

In the back test I've tested it at different times. All the time the drawdown is no more than 15% of the money deposited, and that's really cool.

The amount deposited in back test is the same amount in the demo account.

In the back test the expert advisor makes big profits, but in the demo account I lost all my account in less than two days.

I don't know what's the reason for this big difference between back test and the demo account.

But I doubt a certain thing...

Is it possible that there are some bugs they're ignored when we're doing back test, and these bugs also don't appear in the journal's list?

I mean maybe there are some bugs that don't appear in the back test and don't appear in the journal list, but these bugs affect the trading results on the real and demo account.

Can this happen? If yes, I think that's why the problem is happening.

 
Robin:
..

I already explained in my previous posts about why it is different (backtesting and trading on demo account): EA makes this difference.

I remember that many years ago "some commercial guys" spent time and energy in order to show such a backtesting result (for example: from 3,000 to 300,000 in one month) to make money on newbies on external commercial websites (to sell those EAs on their commercial websites) ..
because we know that such a profit (from 3,000 to 300,000 in one month) does not exist in the World for any EA ..

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
, then each symbol positions will be closed in the same order, in which they are opened, starting with the oldest one. In case of an attempt to close positions in a different order, the trader will receive an appropriate error. There are several types of accounts that can be opened on a trade server. The type of account on which an MQL5 program...
 
Sergey Golubev:

I already explained in my previous posts about why it is different (backtesting and trading on demo account): EA makes this difference.

I remember that many years ago "some commercial guys" spent time and energy in order to show such a backtesting result (for example: from 3,000 to 300,000 in one month) to make money on newbies on external commercial websites (to sell those EAs on their commercial websites) ..
because we know that such a profit (from 3,000 to 300,000 in one month) does not exist in the World for any EA ..

Thank you for your time Sergey.

The discussion with you was really great 👍

Thank you again.

 

Hi Robin, 


I have the same issue with backtesting on MT5 vs forward testing with a demo account

I am using a scalping strategy so I understand speed of execution, slippage, spread etc are all very important. 


When backtesting on MT5 I use every tick based on real tick (100% history quality) and 10 ping (same as my server). There was one day within my data which had lost 95% of that days tick data and shown up with this in the journal before the test started so I have taken this day out leaving me with no negative comments about tick data in journal. 


Did forward testing with a live account help? Meaning there are differences in demo vs live account feed of tick data/other differences?

As opposed to issue with my tick data in backtest. Apart from ping and tick data are there other settings needed to make the test realistic? (assuming real tick setting includes spread?)


Thanks, Matthew 

 

Hi everyone,


I have the same issue and I think I've worked out why. (Not 100% sure and hope people who understands more can prove or disprove my theory)

It could be the execution time!

As you might already know, in real/demo trades the total delay time = latency time(Ping) + execution time. We can use VPS to limit the latency time within 1ms, but cannot do anything to improve the execution time, which is mostly 50~200ms to my experiences.(of course it depend on broker/order type/market liquidity... and varies a lot)

However, in MT5's back test, the "delay" in settings only simulates the latency time, and the execution time is... immediate!! It might explain the difference between a real trade and a trade in a back test even with a 100% accuracy.

For example, in a real trade, the latency is 5ms and the execution time is 200ms. It means from the moment you send an order to it's actually filled in the market, it takes 5ms + 200ms = 205ms.

However, in MT5's back test, you can only simulate the latency time 5ms and the execution time is 0. So the result will be from the moment your send an order to it's actually filled in the market, it takes only 5ms.


So why I reached the conclusion above? I did experiences in an EA to send several orders at the same time in the asynchronous way. Right after the orders were sent, I added some codes checked the result and found out that they were all filled. It would be impossible in real trades(must wait for latency time and execution time), but in MT5 all orders seem always to be filled immediately.


Last, what's the solution? I'm using the Sleep() function before any order sending or order modifying codes for back test(of course only for back test, always delete it in real trades). I might not be the best way and if anyone have better ideas please share it with us. Thanks!!

Documentation on MQL5: Trade Functions / OrderSendAsync
Documentation on MQL5: Trade Functions / OrderSendAsync
  • www.mql5.com
OrderSendAsync - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: