OPEN-SOURCE SCRIPT

Backtest Adapter

Updated
This is a proof-of-concept Backtest Adapter that can be used with my recent publication "Machine Learning: Lorentzian Classification" located here:

Machine Learning: Lorentzian Classification


This adapter is helpful because it enables interactive backtesting with TradingView's built-in "Strategy Tester" framework without the need to translate the logic from an "indicator" script to a "strategy" script.

To use this, one must have the "Machine Learning: Lorentzian Classification" script and this Backtest Adapter open simultaneously on the same chart. From there, simply change the "Source" setting of the Backtest Adapter to "Lorentzian Classification: Backtest Stream" to transfer the entry/exit signals stream to the Backtest Adapter.

For an example of how to implement your own backtest stream in your indicators, please refer to the "Backtesting" section in the source code of the "Machine Learning: Lorentzian Classification" script, which is shown below for convenience:

snapshot
Release Notes
Updated the Source of the Backtest Adapter to be set to "Lorentzian Classification: Backtest Stream"
Release Notes
Removed hardcoded `transactionQty` to use default strategy quantity, simplifying order execution code.
backtestbacktesterbacktestingPine utilitiesstrategystrategytesting

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?


❤️ Patreon w/ Lorentzian 2.0: patreon.com/jdehorty

🎥 Lorentzian Classification Tutorial: youtu.be/AdINVvnJfX4

🤖 Discord: discord.gg/ai-edge-107567337

⏩ LinkedIn: linkedin.com/in/justin-dehorty
Also on:

Disclaimer