Executing Backtests

Executing Backtests #

It is always a good idea to test your strategies in an isolated environment before letting them place orders or execute other important outcomes. The backtesting feature does just that: it allows you to test your strategies with the latest and historical candlestick data while you are still designing them.

Note that to be able to execute backtests, you need to have an active exchange configuration.

To start, open/create an engine configuration (more information on how to do that can be found here), select a strategy, and then click Backtest on the right side of the screen:

Step 1

In the backtest setup pop-up, you will see the name of your strategy along with its candle interval (to change the interval, close the pop-up and go to the Options tab of your strategy). You will also be able to choose what symbol/asset pair to use in your test, as well as which and how many candles to test (1 candle equals to 1 test, 2 candles equal to 2 tests, and so on). You can either select the candles on the chart by dragging and dropping with your cursor (one click will activate the selection box, another will confirm the selection and deactivate it), or you can use the input fields to the right of the symbol selection field (the timestamp input field represents the timestamp of the last/rightmost candle, and the number input field to its right has the number of the selected candles, counting backwards from the last/rightmost candle). Once your test input data is ready, the pop-up should look something like this:

Step 2

Now, click Execute and you will be taken to a page that is dedicated to the test results of your strategy. The test frames on the left side of the screen represent the tests that have been executed. Note that each frame is named after the candle that was targeted during that particular test and they are ordered from the oldest (bottom, executed first) to the latest (top, executed last):

Step 3
When a candle is being tested, it becomes the “latest” candle in that test, even if it is not the latest candle in the selected candles’ list. In other words, the candle which is targeted and its timestamp become the temporary “now”, but once its test finishes, the next selected candle becomes the new “now”. This process repeats until the last and the real latest candle is tested.

Next, select a test frame and you will see your strategy as you have configured it to the right of the test frame list: all your options, tools, and outcomes will be there. However, the main difference here is that along with the configuration data, which is also known as the inputs, you will be able to see the execution results, or the outputs, that have been produced during the selected candle’s test:

Step 3

Different tools will have different outputs, but you can inspect them all in the Outputs tab on the right side of the screen.

When a strategy is being backtested, outcomes are not executed. Likewise, there are some tools that cannot be tested with data from the past (e.g., the Telegram text analysis tool). Note that tools that cannot be backtested automatically return positive results.

Once you are done inspecting the backtest results, click Back to configuration to return to your engine configuration.