# How to Run a Backtest for Your Trading Bot

[Backtesting ](/features/backtesting.md)is a crucial step in evaluating the performance and effectiveness of a trading bot. It allows you to simulate trades using historical market data to assess how well your bot would have performed in the past. In this article, we will guide you through the process of running a backtest for your [trading bot](https://darkbot.io/bots).&#x20;

***Please note:*** *backtest will be conducted using the latest 500 candles from the stock exchange.*

**Step 1: Select the Bot and Access the Bot's Detail Page**&#x20;

Navigate to the Bots page and choose the trading bot you want to backtest. Click on the bot to access its detailed page.

<figure><img src="/files/rAiZ5XVhOi9ijXNQ3McW" alt="Bots page"><figcaption><p>Bots page</p></figcaption></figure>

**Step 2: Access the Backtest Tab**&#x20;

On the bot's detail page, locate the Backtest tab. Click on it to access the backtest settings.

<figure><img src="/files/6gdRgPWdy31Q75otj4eW" alt="Backtest tab"><figcaption><p>Backtest tab</p></figcaption></figure>

**Step 3: Initiate a New Backtest**&#x20;

In the Backtest table, click on the \[Run a new Backtest] button. This will open a new window where you can configure the backtest settings.

<figure><img src="/files/ziMJtnubfC6HStljQJh7" alt="Run anew backtest button"><figcaption><p>Run anew backtest button</p></figcaption></figure>

**Step 4: Select the Market**&#x20;

In the opened window, choose the market on which you want to run the backtest. This is the market where the bot's trading actions will be simulated.

<figure><img src="/files/m8JD0rQybOOgA9SLODBU" alt="Market select-box"><figcaption><p>Market select-box</p></figcaption></figure>

**Step 5: Specify the Initial Balance**&#x20;

Enter the initial balance you wish to allocate for the backtest (by default Initial Balance = 100). This represents the starting capital that the bot will use for trading during the backtest.

<figure><img src="/files/BkuQupZaGj7GxNUz2tZv" alt="Initial balance input"><figcaption><p>Initial balance input</p></figcaption></figure>

**Step 6: Run the Backtest**&#x20;

Once you have set the market and specified the initial balance, click the "Run" button to initiate the backtest process.

<figure><img src="/files/4zmmfju32B1iLoj2hhmD" alt="Run button"><figcaption><p>Run button</p></figcaption></figure>

**Step 7: Await Notification of Successful Backtest Execution**&#x20;

Wait for the system to process the backtest. You will receive a notification once the backtest has been successfully executed. And in the table of backtests a new backtest will appear with the status "New".

<figure><img src="/files/weGmt0dIhXizzSto6HeE" alt=""><figcaption><p>Notification of the successful launch of the backtest</p></figcaption></figure>

**Step 8: Refresh the Page and Review Backtest Results**&#x20;

After the backtest is complete, refresh the page. In the [Backtest table](/backtesting/backtest-result-table.md), you will see the completed backtest with the status "Completed" and the corresponding backtest results. Review the results to evaluate the performance of your trading bot.

<figure><img src="/files/8wVtV41rlQsDIlpYRjhw" alt="Refresh button"><figcaption><p>Refresh button</p></figcaption></figure>

**Conclusion:**&#x20;

Running a backtest for your trading bot allows you to assess its performance based on historical market data. By following the simple steps outlined in this article, you can initiate a backtest and gain valuable insights into the bot's effectiveness. Remember to analyze the backtest results carefully to fine-tune your trading strategies and improve your bot's performance.


---

# 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.darkbot.io/backtesting/how-to-run-a-backtest-for-your-trading-bot.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.
