Backtesting

Ekliptor

Administrator
Staff member
General note about Backtesting:

WolfBot's backtesting more accurate than most other crypto trading bots. In particular, its backtesting engine takes into account:
  • Single trade data: WolfBot runs backtests by replaying every single trade of the exchange in your chosen time period. Many other bots don't use trades at all for backtesting and instead just run a quick simulation on the candlestick chart data. Those bots give you inaccurate results and only a limited amount of candle sizes (30min, 1h,...) to choose from.
    This is being used to exaggerate profits by some backtesting engines, such as TradingView always assuming that price moved in your favor first within a candle when executing stops (see here).
  • Volume: If you trade larger amounts on illiquid markets, many backtesting tools will be highly inaccurate because they just execute every order you give them at the requested price. In markets of small coins your orders for large amounts obviously won't go through at the requested rate because the orderbook is too thin. WolfBot's backtesting simulation keeps track of the traded volume when replaying historical trades and only executes as much of your orders as there was actually volume traded during that moment.
  • Prices for limit orders: Some bots don't support any limit orders at all when backtesting. They just do market orders and assume every order goes through. This obviously leads to highly inaccurate and unrealistically well-performing backtests. Some bots might do this on purpose to show good backtesting results for marketing purposes. WolfBot executes limit orders accurately at given price levels or cancels/moves the order otherwise (depending on your strategy settings) to give the most accurate results.
  • Slippage: Our backtester takes slippage into account. The simulation of every backtesting software has the disadvantage that it assumes your trades have no effect on other players in the market. This can be true as long as you are trading smaller amounts. However, with larger amounts your orders obviously will cause other traders/bots/market makers/... to adjust their orders too. While there is no way to realistically estimate how those traders will react to your orders, if you are trading larger amounts it's a factor you should consider. To do this, WolfBot can additionally set an assumed slippage parameter in percent on the Backtesting page. Beginners can ignore this setting. Generally, the larger your orders are and the less liquidity is in the particular coin market you are backtesting, the higher you should set the (presumed) percentage of slippage to get accurate backtests.
  • Trading Fees: WolfBots trading engine takes into account trading fees of every trade you make. Some trading (high-frequency?) bots show unrealistically promising results doing over 500+ trades per day. This is often due the lack of deducting trading fees on every trade. WolfBot has pre set the default trading fees for every exchange it supports. For exchanges offering tiered trading fees, it uses the lowest tier rates (meaning the least amount of volume traded by you). You can also adjust this value on the Backtesting page to your needs if you are trading in a different tier on your exchange.
    So whether you are simulating high-frequency trading or trading on a daily basis, WolfBot gives you the most realistic and accurate results.
That being said. Keep in mind that backtesting is still just a simulation. Every exchange has has a different trading engine, handling incoming orders a bit differently (market orders, limit orders, trailing-stops). Some exchanges even run their own market maker desk, which arises the question if there is conflict of interest when they process orders of their customers vs their own. So backtesting will give you a general idea if your strategy works under particular market conditions or not. There is however no point in optimizing all the after comma-digits of your simulated profit results.



Steps to start backtesting:

If this is your first time opening your WolfBot instance, you might also want to read the Getting Started guide.

WolfBot supports live trading your well-tested config while backtesting new ideas of another config.You don't have to restart for backtesting. A restart is only required to change the current live trading configuration, i.e. the config showing up under "Strategies".

  1. Go the the "Configuration" page and select a config you want to use. We recommend copying the original config file so you can make changes and compare multiple versions with different parameters of the same strategies.
    back1.png
  2. Edit the config parameters in the trading tab according to your wishes. There can only be 1 currency pair for backtesting in this config. So if it has more currency pairs in it (used for live trading) you have to remove the other currency pairs.
  3. Go to the "Backtesting" page and select the timeframe you want to use to test your strategy on historical trades data.
    For backtesting we generally recommend using a time period of 1-4 weeks from the previous week. If you expect a certain market scenario to repeat (particular drop, high volatility week,...) or want to test how your strategy performs during this market you should go back further in time and select a date range from that period.

    back2.png
  4. click "start Backtesting". You can only run 1 backtest at a time. However, backtests don't interfere with your live trading. You can do live trading (with the same or a different configuration) while doing backtests to improve your trading strategies or try out new ideas.

    Note about "Start balance":
    You can usually leave this field unchanged, using 1 for trading with BTC as base currency or 1000 when trading with USD as base currency.
    Keep in mind it must be higher than the "tradeTotalBtc" setting from the configuration you want to backtest. This value is also always in the base pair (BTC, USD,...) and specifies the amount WolfBot will use per single trade. This amount will be leveraged (2x, 3x,...) if you enabled margin trading in your configuration.

    Note about margin trading:
    If you set "marginTrading" to true in your config, then "tradeTotalBtc" will be leveraged. The leverage value has a default recommended value per exchange (usually low leverage such as 2x, 20x on BitMEX) and can be changed by adding "maxLeverage: 3.0" to your config.

To start backtesting immediately (without waiting for imports of trades) you can choose one of the following currency pairs and exchanges in your configuration.
Currently the full history is available for (you can view this list by clicking on "Show currencies with fully imported history" on the backtesting page):

Bitfinex:
USD_BTC
USD_ETH
USD_LTC
USD_BCH
USD_XRP
USD_EOS
USD_IOTA
BTC_ETH
BTC_BCH
BTC_EOS

Poloniex:
USDT_BTC
USDT_ETH
BTC_ETH
BTC_LTC
BTC_DASH
BTC_XMR
BTC_DOGE

The history updates every 24h, so it might not fully include the last day.
 
Last edited: