# Bonsai BX (Backtester)

<figure><img src="/files/0OUFeNhhGuxzCMetAY9C" alt="" width="125"><figcaption></figcaption></figure>

## **🌳** Bonsai Backtester: A Universal Strategy Tester 🌳

### 🌟 Introduction <a href="#user-content--introduction" id="user-content--introduction"></a>

Navigating through trading strategies often presents complexities. Bonsai Backtester simplifies this journey by offering a sophisticated, comprehensive solution for evaluating multiple trading strategies. Developed in collaboration with the Bonsai community, this tool aims to provide traders with insightful, data-driven analyses. Additionally, it introduces a set of innovative features not commonly found in existing tools, significantly contributing to the collective capabilities available within the TradingView community.

<figure><img src="/files/QMHNcvUFIhjmZjJQHt86" alt=""><figcaption><p><strong>Read the disclaimer section at the end</strong></p></figcaption></figure>

### 📊 Specifics <a href="#user-content--specifics" id="user-content--specifics"></a>

#### Displayed Backtest Details <a href="#user-content-displayed-backtest-details" id="user-content-displayed-backtest-details"></a>

* Conducted over daily candles for BTCUSD on the Coinbase exchange, beginning in March 2015.
* Incorporates signals from the Bonsai indicator for long and short entries. This indicator is presented in the publication chart for reference.
* Adopts the following parameters to offer a realistic and modest trading scenario:
  * Initial Capital: $1,000
  * Maximum Position Size: 10% of equity per trade
  * Stop Loss: 10% per position
  * Commission: 0.1%
  * Slippage: 100 ticks

***

### 🎯 Features <a href="#user-content--features" id="user-content--features"></a>

#### 📡 External Indicator Compatibility <a href="#user-content--external-indicator-compatibility" id="user-content--external-indicator-compatibility"></a>

Bonsai Backtester is engineered to accept output signals from either built-in or custom indicators available on TradingView. These signals can serve as separate or combined inputs for long and short positions, as well as act as filters, thereby broadening the spectrum of strategy alternatives.

***

#### 📋 Quick Insights Table <a href="#user-content--quick-insights-table" id="user-content--quick-insights-table"></a>

For a quicker understanding of your strategy's performance, the tool includes a table that shows key data such as equity, open profit, current position size, and entry price.

***

#### ⏳ Timeframe Customization <a href="#user-content--timeframe-customization" id="user-content--timeframe-customization"></a>

Users have the flexibility to tailor the backtesting period, making it possible to refine analyses to specific trading days or sessions.

***

#### 🎯 Risk Management <a href="#user-content--risk-management" id="user-content--risk-management"></a>

Our tool integrates a multifaceted Take Profit and Stop Loss system that grants traders the freedom to personalize their risk strategy. Among its features is a trailing stop mechanism with trigger settings, such as percentage-based and breakeven triggers.

***

#### 🌈 Dashboard Themes <a href="#user-content--dashboard-themes" id="user-content--dashboard-themes"></a>

Dark or light theme options for optimal visual background.

***

### 📜 How to Operate <a href="#user-content--how-to-operate" id="user-content--how-to-operate"></a>

1. Add the Bonsai Backtester to your TradingView chart.
2. Open the script parameters to adjust the settings and incorporate signals from external indicators.
3. Once configured, utilize the tool to optimize and fine-tune your trading strategy.

***

### 🌐 The Bonsai Community <a href="#user-content--the-bonsai-community" id="user-content--the-bonsai-community"></a>

Input from the Bonsai community is pivotal for the script's ongoing refinement. As part of our commitment to adaptive, smart trading, this script will continually be updated to meet the ever-changing requirements of traders. Let's cultivate smarter trading, the Bonsai way! 🌳📊

***

### ❗️ Disclaimer <a href="#user-content-disclaimer" id="user-content-disclaimer"></a>

Backtesters are built to simulate historical trading scenarios and should never be viewed as a forecast of future outcomes. It's crucial to conduct your own thorough due diligence, weighing all factors like current market conditions and financial risks before committing to any trading action.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bonsai.trade/bonsai-docs/bonsai-bx-backtester.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
