Improve start date and end date of backtest
Hi,
When I backtest, I'm usually annoyed by the fact that there are some open trades at the end of the test, and that those are being closed when the backtest end.
In my EAs, I added an input value that allow to specific a nice start and nice end date, where the EA doesn't have the right to open new initial trade before nor after.
It has the right to finish whatever it is doing (i.e. open more positions for the existing serie, in case of a martingale, for example), but it cannot open new initial trades.
In the case of my EA, there's an indicator that need 2 years of data, so I need to start my backtest 2 years earlier than the date at which the EA has the right to start trading, to ensure that the EA has been able to load all the historical data that is necessary for my indicator.
The goal of the "start date" is to ensure that all the required historical price is loaded for all indicators.
The goal of the 'end date" is to avoid what we see at the end of the test, see the image that I'm attaching.
The other image is an example of what inputs I have in my EAs.
I can provide you with the actual code Andrey, if you want. Ping me on Telegram if you need :)
Thanks
Thomas
In case it's not clear how to use those values, here is , another screenshot for both the "Settings" window and the "Inputs" window.