The backtest tab not showing when using the strategy back tester - page 4

 
Fernando Carreiro #:

Not according to the screenshots. Some positions were still open at 23:59. So, as stated before, put in some prints or use the debugger to find out.

That is what programming is about. When something is not as you expect it to be, you debug it until you find the issue and fix it. I'm old school. In my day, there were no forums to ask questions. You had to grind it out. You only had the physical manual as reference, and you debugged the code until you got it right. It may take a longer, but you learn a whole lot more than when someone spoon-feeds you the answer. That is how you gain experience and skill.

The issue has been resolved.

 
Fernando Carreiro #:

I personally never use "Open Prices" modelling, ever. I only use the "Every tick based on real ticks", and on rare occasions when I have no other option, then I may use "Every tick" (virtualised ticks).

So, I am unable to offer you any further advice, on the "Open Price" modelling method.

What is the difference in accuracy between real ticks and just normal ticks and is it also strategy dependent?
 
Colin Kimble #: What is the difference in accuracy between real ticks and just normal ticks and is it also strategy dependent?

The non-real "normal" ticks, are generated or "virtualised" ticks data and their evolution is not very realistic in my opinion. Read the following article to get an idea on how they are generated.

Articles

The Algorithm of Ticks' Generation within the Strategy Tester of the MetaTrader 5 Terminal

MetaQuotes, 2010.06.02 17:22

MetaTrader 5 allows us to simulate automatic trading, within an embedded strategy tester, by using Expert Advisors and the MQL5 language. This type of simulation is called testing of Expert Advisors, and can be implemented using multithreaded optimization, as well as simultaneously on a number of instruments. In order to provide a thorough testing, a generation of ticks based on the available minute history, needs to be performed. This article provides a detailed description of the algorithm, by which the ticks are generated for the historical testing in the MetaTrader 5 client terminal.
Also, the spread used with the "virtual" ticks, is based on the recorded "bar spread", which is usually the lowest spread of the bar, not the average. Use the following indicator to see the recorded "bar spread" for each bar.

Code Base

Simple bar spread indicator as reported by the OnCalculate data

Fernando Carreiro, 2022.05.01 14:05

Very simple indicator to plot the values of the spread[] data as reported by the OnCalculate event handler.

You can however, specifically set a fixed spread in points to improve the condition on all the non-real tick modelling methods. Follow the example instructions in the following post ...

Forum on trading, automated trading systems and testing trading strategies

Data for backtesting

Fernando Carreiro, 2023.01.02 18:52

When you are testing against broker M1 data, you can set the spread in the Strategy Tester to a fixed value of your choosing (just like it was on MT4).

Click on the image below to see the GIF animation ...



 
Fernando Carreiro #:

The non-real "normal" ticks, are generated or "virtualised" ticks data and their evolution is not realistic. Read the following article to get an idea on how they are generated.

Also, the spread used with the "virtual" ticks, is based on the recorded "bar spread", which is usually the lowest spread of the bar, not the average. Use the following indicator to see the recorded "bar spread" for each bar.

You can however, specifically set a fixed spread in points to improve the condition on all the non-real tick modelling methods. Follow the example instructions in the following post ...


Thank you for the guidance!

 

On a side note ... When beck-testing or even live trading on the daily chart, a common mistake by almost all newbie traders/coders, is assuming the market is open for trade at the start of the day. Most of the time, it is not, but it depends on the symbol being traded.

For cryptos, it may not be the case if the broker trades 24/7, but it depends on the broker. But for Forex and CFD's it is usually the case that it is non-tradable at the end and start of the day, where brokers usually close the trading process a few minutes before the end of the day, and only resume trading a few minutes after the start of the day. They use this time to calculate the swaps.

So, usually it is not possible to place an order at 0:00 of the day and when trading resumes approximately 5 mins after that, the spreads are usually extremely wide at that point.

So, remember to adjust your strategy to take that into account, and remember that during testing, especially when using "real-tick" testing, you will get a "Market Closed" error when you try to place an order at the start of the day for symbols that have this condition.

You can have a look at the symbol's contract specifications to see their trading schedule.


 
Fernando Carreiro #:

On a side note ... When beck-testing or even live trading on the daily chart, a common mistake by almost all newbie traders/coders, is assuming the market is open for trade at the start of the day. Most of the time, it is not, but it depends on the symbol being traded.

For cryptos, it may not be the case if the broker trades 24/7, but it depends on the broker. But for Forex and CFD's it is usually the case that it is non-tradable at the end and start of the day, where brokers usually close the trading process a few minutes before the end of the day, and only resume trading a few minutes after the start of the day. They use this time to calculate the swaps.

So, usually it is not possible to place an order at 0:00 of the day and when trading resumes approximately 5 mins after that, the spreads are usually extremely wide at that point.

So, remember to adjust your strategy to take that into account, and remember that during testing, especially when using "real-tick" testing, you will get a "Market Closed" error when you try to place an order at the start of the day for symbols that have this condition.

You can have a look at the symbol's contract specifications to see their trading schedule.


Thank you!