Articles on: Signals and Automation

Grid Bot Backtesting in Altrady

Grid Bot Backtesting allows traders to compare grid bot settings, strategies and markets using real historical price data for a period of up to one month. It simulates trades and reports the PnL for the tested scenario, providing an invaluable tool for refining your grid bot trading edge.

Grid Bot Backtesting is available from V4.0, which can be accessed here or download and install the latest version of the app under Settings>Check for Updates.


How to access the Grid Bot Backtester
Backtest Settings
PnL Breakdown
Backtesting History
Simulated Trades
How to use the Grid Bot Backtest
How does backtesting differ from live grid bot trading?
The impact of your initial investment currency/s and purchases
Stop Loss and Take Profit
Backtesting is conducted in an artificial environment

How to access the Grid Bot Backtester

Choose the Bots option on the left side menu.
Then either:
Click Create Bot> Grid Bot, or
Open an existing grid bot, and choose the Settings tab

Create a new grid bot or select an existing one

On the Settings page, you can enter test settings or keep the existing settings. Note that these can also be changed in the Backtester.
Click Backtest to enter the Backtesting environment.

If settings are entered on the Settings page, these will be carried over to the backtester.

Backtest Settings

If you entered settings on the Settings page, these will be carried over to the Backtester. If not, you can enter Settings here. These are the mostly same as for the Settings page, with the addition of preset options for Upper and Lower price: 7 day high and 30 day high, 7 day low and 30 day low, respectively.
Trailing Up and Trailing Down can also be selected.

Test Investment Size must be entered. This is not validated against your account size.

Start Time The simulation will start at the selected date, which can be up to one month before the current date.

Enter Settings here including Invested Amount (position size) and fee rate


Optionally, enter a fee rate. This is the percentage fee rate to be applied to each trade, for example 0.075% for Binance with BNB. It is wise to use the actual fee rate your exchange will charge you for trades, to improve the accuracy of your backtest.
Maker and Taker fees: Note that some exchanges charge different fees for Maker and Taker orders. Most orders filled in Live grid bot trading are Maker orders, with perhaps 5-15% being Taker orders. This will vary with market volatility, and the distance between orders. The Backtester will assume that all orders are Maker orders, so for a more accurate estimation of fees, use a value somewhere between the Maker and Taker fee. For example, if the Maker fee is 0.05% and the Taker fee is 0.1%, a rate of 0.06% would be a reasonable estimate for the average fee rate across all trades.

Once the Settings have been entered, click Backtest.

Run the back test using the settings entered

If your backtest results in a lot of orders, it can take a while for the results to be displayed. This will depend on the speed and available RAM of your computer. This slowness is due to the rendering of trade arrows on the Trading View chart.

Once the Backtest has completed, you will see the simulated trades displayed on the chart. The trades are also listed under the Simulated Trades tab.

The grid will be shown at its original price range, even if Trailing Up or Down has occurred during the simulation.

The grid will be shown at it's original price range even if Trailing has occurred.


The results shown are the same as for our live Grid Bot, with the addition of the PnL Breakdown and Investment Summary, (as currently shown in the Breakeven Calculator for live Grid Bots described here).

In summary:
Invested: the initial amount allocated to the grid bot
Net PnL: the total profit or loss accumulated by the grid bot, net of fees
Net PnL %: The net PnL as a percentage of the Initial Invested Amount
Grid Profits: The profit gained purely from matched pairs of orders in the grid
Total Trades: the number of simulated trades the bot made in this backtest (Total, Buy and Sell)
Grid Profit %: The Grid Profit as a percentage of the Initial Invested Amount
The price range is shown, along with icons representing whether Trailing Up and trailing Down were enabled.

Click on PnL Breakdown and Investments to open or close these sections of the results.

PnL Breakdown

Realised PnL: The amount of base currency that has been both bought and sold is used to calculate RP.
Unrealised PnL: The renaming amount of unsold (or unbought) coins, valued at the current price
Net PnL: Total of Realised and Unrealised PnL
Fees: the total estimate of fees paid, using the fee rate in the settings (note that fees are paid on every buy and sell)
Percentages: For each element, the percentage of the Initial Invested Amount is shown.


The Investments section summarises the amounts and value of base and quote currencies bought and sold in all of the simulated trades for the current backtest.
Where the remaining amount of quote currency is negative, more has been recovered than was invested (i.e. profit).

Backtesting History

Each backtest conducted will be listed here in chronological order.

Click Show to recall the settings and results of a previous backtest.

Choose a previous Backtest by clicking Show on My Backtesting History tab

Simulated Trades

The Simulated Trades for a backtest are be listed under the Simulated Trades tab and the trades will be shown in the chart.
The list of simulated trades includes all trades taken for the selected backtest, in chronological order. For each trade, you can see the time and all other trade details for the backtest.
The list can be scrolled using a mouse. Or click in the list and use Page Up/Down or arrow Up/Down on the keyboard.

Simulated trades

Using Backtest Settings for a Grid Bot

(V4.2 and above)
If the back test has been run on a new Grid Bot (using Create Bot>Grid Bot), the back test settings can be transfered to the GB settings page.
Check that the backtest has been run or selected from the history.
Click Use this setup.
If you have more than one Trading Account for the exchange, a dropdown menu will appear: select a trading account.

Use the Bact Test settings for a new grid bot

The settings, including the position size (but not estimated fees) will be transfered to the GB Settings page.
Make any necessary changes and additions, incuding:
Invest Coin
Investment Amount
Take Profit
Stop Loss
Save the Settings as usual.

The Back Test settings are copied to the Settings page for the new grid bot

How to use the Grid Bot Backtest

While the past does not predict the future, it can provide very useful comparisons. Backtesting is especially useful for practising and refining your skills in choosing markets and settings for your grid bots. Here are some tips for getting the most from Altrady’s Grid Bot Backtesting:
Compare the impact on PnL of the fee rates on each exchange available to you.
For the same market, compare the difference between using a wide price range that includes previous low and high prices with a narrower price range and Trailing Up or Trailing Down.
Is a different approach needed for spiky and non-spiky markets? (“Spiky” is a technical term referring to a lot of upwards and or downwards wicks on a chart.)
Compare the same price range with different numbers of grid orders.
Test your foresight: without looking at what happens to the price between your Start time and now, choose a price range and number of grids based only on the price history or technical analysis for the market as it was at the start date. This will hone your skills at choosing grid settings.
Compare profitability of volatile vs. more stable markets.
Compare the profitability of markets that are trending up, sideways and down.
Note prices where it would have been beneficial to have placed a Stop Loss or Take Profit order on a Live bot.

How does backtesting differ from live grid bot trading?

Backtesting simulates trades which differs from placing real orders on an exchange:
The exchange might not accept your settings, for example:
If you are restricted from trading a certain market (such as leveraged tokens, or other markets due to your location)
Limits on how far from the current price an order can be placed (maximum of 30% distance for some markets on some exchanges)
Exchange limits on the amount invested in one coin (mostly leveraged tokens)

The results are only as valid as the settings:
If the wrong fee rate is used
Other costs are not factored in, such as rebalancing or extra fees for leveraged tokens

The impact of your initial investment currency/s and purchases to start the grid

Backtesting cannot factor in whether you would have started your grid bot with quote currency only, base currency only, or a mixture of the two. In Live grid bot trading, this can impact profits.
If you start with quote currency only, then starting your bot when the price is low in your grid will be more profitable that if the price is higher in the grid: the initial purchase of base currency for the Sell orders will be at a higher or lower price.
If you start with some or all base currency, then a Live bot might need to sell some to fund buy orders for your grid bot. In this case, 1. The bot will start with a Sell order, so it will be Short (by definition). 2. Your grid bot will be more profitable if it is started when the price is higher in the grid, and when it buys back those coins, it will be at a lower price.

Stop Loss and Take Profit

These settings that you might use on a Live bot are not available.
This can mean that a bot with Trailing Down selected would continue to trail down below where you would have placed a Stop Loss for a live bot. This can affect the PnL for better or worse.

Backtesting is conducted in an artificial environment.

Live grid bots can be affected by exchange issues (e.g. high volatility can mean that order placement slows down)
Order fills are more conservative (less likely) in a simulated environment than for a Live bot with real order placement. See the section on Order Fills in our Paper Trading documentation. This means that a Live bot would be more likely to have a higher number of trades. You can assess this in the chart by checking how many wicks end on a grid line, without a trade arrow.
The exception is for larger position sizes, where inadequate liquidity of the live market might reduce the number of orders filled.

Grid Bot Settings
Grid Bot Processing
Grid Bot Error Messages
Grid Bot Analytics

If you have further questions, please contact our Customer Support, linked at the bottom of this page.

Updated on: 30/01/2024

Was this article helpful?

Share your feedback


Thank you!