Integrating Indicators

Developed a custom indicator on TradingView and wish to backtest it? Bonsai BX is your solution. Use your indicator outputs as inputs for the Bonsai BX backtester.

This is needed especially if your indicators display signals as shapes on the chart, which are not directly usable as sources for other indicators or strategies on TradingView.

Step-by-Step Guide:

  1. Access Pine Script Editor. Open your Pine Script editor on TradingView and select your custom indicator.

  2. Modify Your Script. Append this code at the end of your script:

plot(long_condition ? 1 : 0, title = "🌳 Your_Long_Condition", display = display.none, editable = false)
plot(short_condition ? 1 : 0, title = "🌳 Your_Short_Condition", display = display.none, editable = false)
  • Replace long_condition and short_condition with the variable names in your script that signal the long and short conditions.

  • Change "Your_Long_Condition" and "Your_Short_Condition" to preferred names for your long and short signals.

  1. Attach to Your Chart. Add this modified indicator script to your TradingView chart, along with the Bonsai BX (Backtester).

  2. Configure Bonsai BX Settings. In Bonsai BX settings, locate the "Quick Sources 🌳" section and input your newly named signals.

Outcome: By following these steps, your custom TradingView indicators will effectively feed into Bonsai BX, allowing for comprehensive backtesting of your strategies.

Last updated