OPEN-SOURCE SCRIPT

Unbiased Replay Companion

Updated
When using bar replay mode on TradingView, you have to scroll your way back through clearly visible price history, which always leaves you with unwanted lookahead bias because you unfortunately see all future price movements before they are hidden by the use of the scissors tool.

This indicator provides a simple way to hide all the price action and displays a configurable bar counter instead, allowing you to scroll back to every moment in history without seeing any of the prices' movements. The bar counter hereby serves as a visual aid to guide you back to the very first available bar on the chart.

You can configure the color of the overlay to match your charts' background as well as the style of the bar counter and the distance at which the counter is being displayed.

The indicator crops the vertical price scale by a random amount (only when it is being displayed) to also prevent you from having any unwanted bias based on the current price range.

Whenever you're done scrolling and have used the replay scissors tool to start your session just hide the indicator and bring it up again when you need to scroll. That's all there is to it.

Important: After you apply the indicator to your charts, make sure it is displayed in front of everything else. You can configure this by clicking on the three dots that are displayed on the right side of the indicator name on hover and choose "Visual order > Bring to front" from the popup menu that appears.

Enjoy your unbiased backtesting sessions!
Release Notes
This Update sets the default distance between bar counters to 200. No new features have been added.
backtestingbiaslookaheadPine utilitiesreplay

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer