The settings in this section allow you to limit the backtest to a certain range of historic bars.
Before continuing, please read the article on Investopedia about "The Importance of Correlation": https://www.investopedia.com/articles/trading/10/backtesting-walkforward-important-correlation.asp
Directs you to https://bit.ly/bt-optimization which is just a shortened link for the Investopedia article linked above.
The historic bar range to run the backtest on.
All Historic Bars: The strategy will run the backtest starting from the first available bar all the way up to the last available bar.
In-Sample Range: The strategy will run the backtest starting from the first available bar all the way up to the bar with index
Out-of-Sample Range Start.
Out-of-Sample Range: The strategy will run the backtest starting from bar with index
Out-of-Sample Range Startall the way up to the last available bar.
What numbers to use in the ranges?
This depends on your TradingView subscription. The 'Basic' (free) plan gives you 5K bars, the 'Pro' and 'Pro+' plans give you 10K bars, and the 'Premium' gives you 20K bars to backtest on.
For example, if you are on the 'Pro' plan, and you want the 'In-Sample' data to be the first 70% of all available bars, and the 'Out-of-Sample' data to be the remaining 30%, set the
In-Sample Range Start to 0 and the
Out-of-Sample Range Start to 7000. This way, if you choose to backtest on the 'In-Sample' data, the strategy will only attempt to open a position for the first 7000 bars. Alternatively, if you choose to backtest on the 'Out-of-Sample' data, the strategy will only attempt to open a position after the 7000th bar. To find out the bar index of any bar, open the 'Data Window' in the right sidebar, locate the
bar_index row at the bottom, and hover your mouse over any bar on the chart.
Specify the bar index you want the 'In-Sample Range' to start. Best to leave this at 0.
Specify the bar index you want the 'Out-of-Sample' Range to start. This will be also used as the end of the 'In-Sample Range'.