Before we get started, be sure to familiarize yourself with the basics such as what is a backtest, and other similar questions in the Bots FAQs section.
In our initial release, there are several common strategies that can be backtested and run live on a number of supported exchanges. Click here to see if a particular exchange is supported for bot trading.
Backtesting a Strategy
Let's get started by selecting a strategy to backtest. Log in and visit: Platform > Bots
For this example, let's select the MACD strategy:
You will now see the Strategy Workspace where you can configure various parameters:
Remember, you can create multiple instances (copies) of the same bot to try different combination of pairs and strategy settings.
Here's a brief description of each parameter:
- Configuration Name: Give this bot instance a name (default name is automatically generated, you can change this to something meaningful)
- Exchange: Select the exchange to run this bot on. Backtests will use this exchange's historical data and when you're ready to run the bot in live mode, you will be prompted to select an account associated with this exchange.
- Market: The pair you'd like to trade. Our standard convention is Base/Quote. For example in BTC/USD, BTC is the base and USD is the quote currency. When you buy BTC/USD, you are buying BTC and spending USD. Click the chart icon in the input field to view a live TradingView chart of the selected market.
- Starting Capital: Enter the amount of quote currency to allocate to this bot for trading. The MACD strategy bot will use the entire balance for each trade, starting with the "starting capital". For example, if the starting capital is set to 1000 USD, the first trade will buy 1000 USD worth of BTC and sell the entire amount when a sell signal is detected. Subsequently, it will use the entire resulting balance for next trade and so on. Note - In live trading mode, it is up to the user to ensure there is sufficient "available" balance for the Quote currency in order for the bot to continue trading. If you make any manual orders which result in reducing your available balance below the amount required by the bot, an error will be shown and the bot will stop.
- Candle Timeframe: This is the bar timeframe on which to apply the technical indicator used in the strategy to make buy/sell/hold decisions. Signals for trading are generated at the end of each bar/candle. Shorter timeframes will result in more frequent trades and longer timeframes in fewer.
- MACD Slow/Fast/Signal Periods: These are MACD indicator specific values. If you are not familiar with MACD, there are numerous resources and videos available online including a beginners guide here. The default values are what's commonly used by traders, but by no means recommended or best values to use. Feel free to try different combinations that work with the market and candle timeframe you are interested in trading.
- Backtest-Only Settings: Values in this group are used in backtest mode only. All other values apply to both backtest and live mode. Be sure to set the correct values (particularly starting capital) before running the bot in live mode. You can learn more about how these values are used in backtests here.
Once you've configured the parameters to your liking, click the "Backtest" button. You will be prompted to select a backtest timeframe. The timeframe dictates how far back in time you'd like to start the simulation of this strategy. For example, if you select 1 Year, and the candle timeframe selected is Daily, the simulation will run on ~365 daily candles, ending today.
Click "Start Backtest", you will see the progress of the simulation as it is being run:
Note - You can stop a backtest at any time while it is running. Stopping a backtest will discard any results and is only needed if for some reason it is taking too long to complete. Generally, the time it takes to complete a backtest depends on two factors:
- The candle timeframe
- The backtest timeframe
Shorter candle timeframes generally take longer as there are many more bars to process. For example: daily candle timeframe backtested over 1 year period will process ~365 candles and complete within a few seconds whereas 1 minute candle time frame backtested over a 30 day period will process ~302,400 candles and will take over 10 minutes.
Disclaimer: Backtested or simulated performance results have inherent limitations and should not be interpreted as a recommendation to buy or sell any assets nor a guarantee of future returns. Actual results will vary and Quadency makes no representation or warranty regarding future performance.
Once the backtest is complete, the results will be shown:
Let's review each item in the backtest summary:
- Return: This is the overall return of the strategy over the backtest period. It is calculated as PnL / Starting capital or (Ending Capital - Starting Capital) / Starting Capital.
- Starting Capital: In this backtest, our bot was allocated $1000 USD as the starting capital at the beginning of backtest period.
- Ending Capital: This is the resulting equity of the capital managed by the bot. It includes profit/loss from all closed positions as well as any open positions that would not have closed at the end of the backtest period.
- Profit/Loss: This is the net profit/loss as a result of all trades, plus profit/loss in any remaining open positions. It is calculated as (Ending Capital - Starting Capital)
- Market Return: This is the benchmark return. Quadency uses the underlying market being traded as the benchmark for evaluating the performance of any given strategy. In this example, it is the BTC/USD market.
- Excess Return: This is the return in "excess" of the benchmark. It is useful in determining the effectiveness of the strategy. Typically you'd want a strategy to outperform the underlying market, which in this example it does, by 30.12%. If the excess return is negative, but the overall return is positive, the strategy is not as effective and simply buying and holding would be better. Conversely, if the excess return is positive, even if the overall return is negative, it is a good strategy as the resulting loss is less than buy and hold (benchmark).
- Trades: This is the total number of trades executed within the backtest period
- Backtest Completed: The timestamp of the last backtest completion.
- Backtest Window Start: This is the timestamp of the first bar of historical data used for this backtest.
- Backtest Window End: This is the timestamp of the last bar of the historical data used for backtest.
Note: You can run as many backtests as your plan allows. Simply update the parameters and press "Backtest" button again to run another simulation.
The performance chart shows how the capital managed by the bot has grown or declined over time. Flatlines indicate periods in which the bot had no open positions and therefore the capital was not subject to market movement.
Further, all trades executed by the bot are plotted on the chart for easier visualization:
Note - you can hover over the red/green arrows to see the amount and price that was traded. Each trade is also shown in the trades table:
And finally, the logs section shows detailed messages output by the bot as it crosses each bar and makes buy/sell/hold decisions:
The logs can be helpful in troubleshooting issues such as no trades being made due to invalid parameter values or insufficient funds etc.
Running in Live Mode
Note: In live mode, trades are automatically executed in your selected exchange account. Please be sure to verify all parameters including starting capital before starting a bot in live mode.
Once you've found a strategy that works for you, running it live is as easy as pressing the "Start Live" button and selecting the exchange account you'd like to trade on.
Accounts shown here are only those belonging to the exchange selected in the configuration parameters. If you want to run the bot on a different account, select the corresponding exchange in the Parameters tab.
Once started, the bot begins monitoring the selected market and evaluating conditions at the end of each new candle. For example, if you selected 1 minute candle timeframe, the first signal evaluation will happen within the next minute or so. On the other hand if you selected daily candle, the bot will wait for the current daily candle to close.
Live results will become visible after the first candle has completed and you can begin to monitor the bot's live performance, which visually looks very similar to the backtest results, with the exception of trading section:
In live mode, in addition to the performance summary, you will see any open positions, open orders and trade history associated with this bot.
- Open Positions: This is where you can see any current holdings that the bot has purchased. In this example, the 0.03 BTC were bought and current open PnL is -$7.60 for this position. Overall return is shown in the Live Summary in the top section of Live Mode tab. Stats in the Live Summary are updated every minute.
- Open Orders: This is where you can see any open limit orders waiting to be filled. Whether there will be any open orders depends on the bot's strategy.
- Trade History: This table shows all trades (buys/sells) conducted by this bot.
You can stop a bot at any time. However, note that if there are any open positions, you will need to close them manually.
We hope you found this guide to be helpful in getting started with Quadency Bots. There are many more strategies in the works (simple and advanced) so be sure to check back regularly for updates.
If you have any questions, comments or suggestions, please feel free to reach us by emailing email@example.com or initiated a live chat from the button below.