How to use Gavin’s Backtester

Gavin’s DCA bot backtester

In this article we will cover settings and best practices of the DCA Backtester script. (For a quick start on how to use it with the basic settings you can check this video).


Please check this page to request access and add it to your Tradingview account



After you have loaded the indicator on your chart you can access the “Inputs” tab from the indicator’s settings.

You will then be presented with this screen of the DCA SETTINGS

The Backtester is in continuous development and at the moment of writing the article the v 0.7.13 has just been released.
This indicator is designed to simulate the behaviour a DCA bot, therefore you will find all the settings that are familiar when creating a new DCA bot in 3Commas. If you are new to bot trading please refer to how to setup a DCA bot first.

TIP please note that when backtesting with leverage, the BO/SO values are already leveraged in the same way as the 3commas bot works.


After inputting all the DCA bot settings you will then need to select the Deal Start Condition. There are several options available:

ASAP opens the deal immediately after the previous one has finished
Script allows you to use your own script in the backtester. Coding is required.
Ext Indicator allows you to use the other indicators that TTP has created. No coding is needed and this will be the option to select when for example you want to use Victoria as an external indicator.
3C Simulator allows you to backtest all the deal start conditions available in 3Commas.
3C Simulator / Ext indicator combined allows you to use a combination of both the previous two.

For this example we want to use 3c simulator as we are going to show you how to backtest a simple strategy using 3 commas TA presets for BTC.

Once you have selected 3c simulator you will then have to select one of the deal start conditions. For the demonstration we are going to use Bollinger Bands on the 1hr TF.
Once your data is in the backtester you will see the base orders, safety orders and take profits plotted in the chart.

There is a difference between backtesting 3Commas indicators using a 3C simulator and backtesting the actual indicator built in Tradingview.
If you load up the indicators on TradingView and if you use the same indicator on 3commas with the same settings you will notice a discrepancy between when the signal fires and when the condition are actually visually met in the chart. This is mainly happening because 3commas requires a bar close confirmation for some of the indicators. This can make the signal fire a bar later than one would expect.


The backtester can be used to backtest other pinescripts indicators available from TTP, to be able to do so you need to do the following steps

  1. load the indicator you want to backtest into the chart first,
  2. select “Ext Indicator” from the Deal Start Condition drop down menu.
  3. select the relevant “Deal Source” in the drop down menu of the EXT INDICATOR SETTINGS section

  • TIME

You can select a specific timeframe you would like to backtest.
We recommend using maximum 15 min when backtesting since this is a reasonable compromise between accuracy and historic data. 5 min if possible since it’s even more accurate but that limits the timeframe a lot. Unfortunately TradingView doesn’t allow use more granular data yet.
Another thing to consider is that the Backtester will only use candles for its calculations, while the real bot is taking into account the orderbook, so the behaviour of a real bot will always differ from backtesting.
In order to go further back in time when you want to back test a larger timeframe and need to load more data in your chart (still within the limitation mentioned above) you can use the Bar Replay Tool


Plot deal start condition will show all the time the conditions are met to initiate the deal. Only the first one will be picked up by the Backtester (if there is not a Timeout set) and will plot a blue arrow with the Base Order label next to it (first yellow circle).


3Commas uses a closed source external provider for QFL, we have recreated the signal as close as possible to it. It is advisable to check “Require the upper base above lower base to open trades” to filter out abnormal trades.
The 60 minute will simulate the Day trading and Original settings that 3commas and uses for QFL using 1 Hr candle for the calculation of the bases (support), the 120 minutes will simulate the Conservative QFL settings using 2 Hr candles and the 240 minutes the Position QFL settings using 4 Hr candles.

TTP has also released a standalone indicator called QFL single TF to give you even more flexibility with this indicator, please check this page for more info.


You can disregards changing most of the settings in this tab like values in Initial Capital, Base Currency and Order size.
The Backtester is not using these values but only the Base order size and Safety Order Size in the input tab for the calculation. More over the Backtester is designed to only work with one deal open at a time because this is how 3commas bots work. The deals open only if the conditions are met at candle close. For example changing Pyramiding won’t affect the calculation because it only works when testing a classic strategy with one single base order without DCA.
The only setting that would give you some changes is the commission. For example if you use BNB for fees your commission should be 0.075 instead of 0.1


You might want to backtest a third party indicator or your own indicator, not just 3Commas or TTP pinescripts that are already compatible with the Backtester.
Please note that the indicator needs to be open source to be backtestable.
More information can be found also in this article.

First of all you will need to make the indicator compatible with the Backtester. Your indicator will need to be modified so that it will plot 1 and/or 2 to start and close the deal when the conditions are met.

Let’s see the example of making Bollinger Bands built in Tradingview indicator compatible with the Backtester.

  • load the Bollinger Bands indicator on your chart and then click on the source code
  • make a script copy clicking on the three dots
  • give it a name changing the string “indicator so it is easier for you to find it in the back tester
  • change overlay from true to false
  • remove parts of the previous code ( lines 10 to 14 in picture 1 below)
  • add the deal start conditions ( lines 11 and 12 in picture 2 below)
  • then once you press “Add to chart” you will se the signal being fired every time 1 is plotted.

Next you need to connect it to the back tester:

  • load the Backtester in the chart
  • select Ext Indicator in the Deal Start Condition
  • select your indicator that you just renamed in the Deal Source

Please note that the Backtester supports only one deal open at the same time so you will see many signals firing but not deals will be opened if there is already one open.

Below another example on how to backtest RSI, in this case we are using both values 1 and 2 to open and close the deal.


You will need to load both Victoria and the DCA Backtester on the same chart.
(To better visualise when the signals fires is best to have Victoria as a Signal View on your chart)

In the Backtester settings you then need to select Victoria as an external indicator.
(Please see this article on how to use Victoria indicator in more detail.)

and then Select Victoria Trade Signals as a Deal Source in the Ext Indicator Settings section.

Depending on how you set up your dca strategy you will now see the buy and sell plotted on your chart.

Have fun!

Updated on May 19, 2022

Was this article helpful?

Related Articles

Leave a Comment