3Commas DCA Bot Strategy v1.0


The strategy attempts to implement a majority all of the settings found on the 3Commas DCA Bot setting page that can be implemented within a TradingView indicator. Specifically, it will implement the "Open new trade ASAP" and "Trading View Custom Signal" deal start conditions. In this way, you can leverage the power of TradingView's backtester to model your settings and analysis past performance as well as leverage TradingView's alert notification subsystem to send Deal Start and Close signals to 3Commas using almost any of the thousands of scripts found in the Public Library (see "What does it do and how does it do it?" section below for more information on how to do this using the RSI indicator as an example).

How is it original and useful?

This strategy is unique in that it's the only one (as of the initial publications) that can handle 28 out of 32 bot settings (88% coverage) that are found on the 3Commas bot settings page. In addition, because it is a TradingView script, you will benefit from the following:

  • Model your bot's configuration using the backtester on any timeframe and evaluate its performance using the chart's history.
  • View a table of detailed statistics pertaining to deals started and completed, win/loss rates, daily P&L, true max drawdown, and detailed statistics on bars in deal along with safety orders filled.
  • View a table of "Used amount for each step" as presented in 3Commas as well.
  • Ability to link to almost any TradingView chart indicator that provides a single data point for buy/sell signals.
  • Make use of the 3Commas TA Start Conditions indicator to emulate the 3Commas built-in indicators for further performance evaluation with the backtester.

How does it compare to other scripts in the Public Library?

This strategy offers a very detailed, comprehensive settings and maybe the only one (as of the initial publication) that can handle 28 out of the 32 bot settings that are found on the 3Commas bot settings page (that can be handled within TradingView, because some cannot be modeled due to chart and language constraints). Specifically, the following 3Commas bot settings and inputs are addressed with asterisks denoting specific limitation due to TradingView's platform architecture and/or constraints:

Main settings
  • ✅ Name
  • ❌ Exchange* (Not handled since it is inherited from chart)
  • ⚠ Bot type* (Only Single-pair because you simply apply the indicator to as many pairs you desire in separate charts to simulate a Multi-pair setting)

  • ❌ Pairs* (Not handled since it is inheriting the symbol from the chart)

  • ✅ Strategy
  • ❌ Profit currency* (Not handled since there is no equivalence in TradingView)
  • ✅ Base order size / unit
  • ✅ Safety order size / unit
  • ✅ Start order type

Deal start condition

Take profit
  • ✅ Take profit (%)
  • ✅ Take profit type
  • ✅ Trailing
  • ⚠ Trailing deviation* (modified to handle TradingView's broker emulator properly)

Stop loss
  • ✅ Stop Loss (%)
  • ✅ Stop Loss action
  • ⚠ Stop Loss timeout* (modified to use "bars" as the unit of measure)

Safety orders
  • ✅ Max safety trades count (a total of 100 safety orders are supported!)
  • ⚠ Max active safety trades count* (Not handled since there is no equivalence in TradingView)
  • ✅ Price deviation to open safety orders (% from initial order)
  • ✅ Safety order volume scale
  • ✅ Safety order step scale

Advanced settings
  • ✅ Don't start deal(s) if the daily volume is less than
  • ✅ Minimum price to open deal
  • ✅ Maximum price to open deal
  • ⚠ Deal start delay (QFL and standard TV signals only)* (modified to use "bars" as the unit of measure)
  • ✅ Cooldown between deals
  • ✅ Open deals & stop

Close deal after timeout
  • ⚠ The time after which, deal will be closed automatically* (modified to use "bars" as the unit of measure)

In addition to the above inputs, the script will also support the same output data points that are found on the bot settings page, which are:

  • ✅ Balance
  • ✅ Max amount for bot usage (Based on current rate)
  • ✅ Max safety order price deviation
  • ✅ % of available balance to be used by the bot

Table (Used amount for each step)
  • ✅ Order No.
  • ✅ Deviation %
  • ✅ Order Size (Base currency)
  • ✅ Order Volume (Quote currency)
  • ✅ Price
  • ✅ Average price
  • ✅ Required price
  • ✅ Required change
  • ✅ Total Size (Base currency)
  • ✅ Total Volume (Quote currency)

What does it do and how does it do it?

When applied to the chart for the first time, the default settings will work to execute the "Open new trade asap" deal start condition using a take profit of 4%, a base order size of 1.335% of equity (initial capital + net profit), a safety order size of 2.003% of equity (initial capital + net profit), a safety order volume scale of 1.5, a safety order step scale of 1.21, and a max safety trades count of 8. With these settings, as you scroll through the chart's history you should see price action crossing the DCA layers (denoted with blue triangles), and a green take-profit price line will render (with green triangle denoting the crossings). Lastly, in the upper-right corner of the chart the table of DCA statistics will render showing you all the gathered data that took place since the chart's starting history until the current time.

Using the "TV Custom Signal" section will allow you to "link" other chart indicators to supply "Start" and "Close" signals for the script. For example, here's how you can use the standard RSI indicator to generate an entry signal:

1) Add the stock RSI indicator and configure it to your desire.
2) Select the "RSI" indicator in the "Chart/Indicator Data Point" input.
3) Select "Chart/Indicator Data Point" in the "Start Deal When" input.
4) Select "Less Than" in the "Is" input.
5) Select "Custom Value(s)" in the "The Value Of" input.
6) Enter "25" in the "Custom Value 1 (Single or Lower Bound)" input.
7) Select "Trading View Custom Signal" in the "Open new trade" input (in the DEAL START CONDITION section).
8) Lastly, check the checkbox with a horizontal straight line above the "Start Deal When" input.

This means that the indicator will start a deal when the "RSI indicator" is "Less Than" the value of "25".

Strategy Results

The default settings are designed to ensure that the indicator will render chart elements when first loaded as well as to allow the backtester to gather order executions and display performance summary. The chart above is is using $10,000 initial capital, a commission rate of 0.1% for both entries and exits, and a 1 tick slippage setting. It is also using 3.22581% of the equity for the Base Order Size, 6.45161% of equity for the first Safety Order Size. The Maximum Safety Trade Count is 4 with a Safety Order Volume Scale of 2, a Safety Order Step Scale of 1.53, Price Deviation To Option Safety Orders at 5.3, and a take profit of 4.5% with Trailing turned on at a deviation of 1.5%. All other settings are defaults.

It is recommended that the indicator be "tuned" for your specific market in order to best implement the strategy and obtain better desirable results. You do so by using the backtester and statistics table and observe the output values and learn how the indicator is performing in the chart history. Using this information, you can adjust the settings accordingly until you find the settings acceptable to your trading goals and risk tolerance.

Always keep in mind that past performance may not be indicative of future results. Settings that seem favorable for one market may be found to be disastrous in another. Therefore, do take the time needed to understand how the settings will behave with the given chart symbol.

Enjoy! 😊👍

How to obtain access to the script?

You have two choices:

  • Use the "Website" link below to obtain access to this indicator, or
  • Send us a private message (PM) in TradingView itself.
Notes de version: v1.0.5 - Patch Release

New features and fixes in this release for both Indicator and Strategy:

  • Added labels to the checkbox above the "Start Deal When" and "Close Deal When" inputs to make it more clear on how to enable the feature.
  • Added "Position" drop-downs to control the placement of the Statistics table on the chart.
  • Added validation logic to layer position size and price to avoid runtime errors when the safety order configuration is calculating extremely high sizes and negative prices.
  • Added "Stop Loss Timeout Activated" and "Stoploss Timeout Bar Count" data point to the Data Window.
  • Added minor enhancements to the settings UI and table styling.
  • Combined several statistic data point together to keep the Statistics table as short as possible.
  • Fixed a defect where enabling the "Stop Loss Timeout (bars)" feature was not working properly.
  • Fixed a defect where using a "Safety Order Volume Scale" value of 1 was not working properly.
  • Replaced TP, TTP, and SL label shapes with plot shapes in order to avoid the 500 labels limit and improve readability in these events in the chart history.
Notes de version: v1.0.6 - Patch Release

New fix in this release for both Indicator and Strategy:

  • Fixed a defect where the Win/Loss Rate % was not being calculated for Stop Loss Timeouts and when using Close Deal Signal providers.
Notes de version: v1.0.7 - Patch Release

New features and fixes in this release for both Indicator and Strategy:

  • Added the "Trigger" inputs to the "Start Deal Signal" and "Close Deal Signal" sub-sections to control when to accept the signal of either "Once Per Bar" or "Once Per Bar Close".
  • Added the "Closed Deal By Custom Signal" X-Cross shape on the chart when the "Close Deal Signal" is provided by another indicator.
  • Fixed a defect where using the "Stop Loss Timeout (bars)" with a "Stop Loss Action" of "Close Deal & Stop Bot" was not stopping trading.
  • Updated the "Equal" and "Not Equal" options in the "Is" inputs in the "TV CUSTOM SIGNAL" section to "Equal To" and "Not Equal To"
Notes de version: v1.0.8 - Patch Release

New fix for the Strategy version only:

  • Fixed a defect where the Strategy Tester was showing a 2nd safety order entry but the total volume size for the safety order was unevenly split between the two. The fix involved implementing a workaround with the strategy.exit() function by supplying a value for the 'from_entry' argument instead of omitting it to handle all the orders.
Notes de version: v1.0.9 - Patch Release

New features and fixes in this release for both Indicator and Strategy:

  • Added the "Timeframe" data point to the "3C-DCA STATISTICS" table.
  • Added more abbreviation settings (MAD & SDSP) to the "Summary" data point in the "3C-DCA STATISTICS" table.
  • Added show/hide input controls for the various sections of the "3C-DCA STATISTICS" table.
  • Added "Show Profit/Loss Zones" and "Show Unrealized Profit/Loss Label" inputs to show or hide these new chart features.
  • Added a "Warning" input to the "ALERT SETTINGS" section to explain the use of the `barstate` variables causing a repaint warning when creating alerts. (Indicator version only)
  • Fixed a defect where the strategy would submit multiple limit orders on the real-time bar as it is crossing a Safety Order layer when "Recalculate On Every Tick" is checked in the Properties tab. (Strategy version only)
  • Fixed a defect where the deviation from the base order for the first safety order was not being inverted correctly for the "Short" strategy setting.
  • Fixed a defect where the first safety order was being considered crossed when the candle that started the deal was also exceeding the deviation percentage from the base order.
  • Updated the "Daily P&L" data point in the "3C-DCA STATISTICS" table to display the calculated daily P & L in deals and for the entire lookback period (in total).
  • Updated the safety order lines to place the price label at the real-time bar instead of the entry bar to improve readability.
  • Updated the inputs in the STRATEGY and SAFETY ORDERS section to match the new UI changes on 3Commas. Also updated tooltip content.
Notes de version: v1.0.10 - Patch Release

New features and fixes in this release for both Indicator and Strategy:

  • Updated the default value of the "Stop Date/Time" input to 2030-01-01.
Notes de version: v1.0.11 - Patch Release

New features and fixes in this release for both Indicator and Strategy:

  • Added new "Ignore Value" inputs for the Start and Close Deal Signal sections.
  • Added new "Link to TradingView Script" and "Link to Documentation" inputs to the "GENERAL INFO" section.
  • Added the "No. of Single-Bar Entries & Exits" data point to the "3C-DCA STATISTICS" table.
  • Added new "Stat Label Font Weight" input to change the font labels to bold or normal for the "3C-DCA STATISTICS" table.
  • Removed almost all tooltip icons and text due to the 60K compiled tokens limitation and tooltips consume a lot of these tokens.
  • Updated the Statistics table rendering criteria to draw the table during Replay mode of the chart.

Script sur invitation seulement

L'accès à ce script est limité aux utilisateurs autorisés par l'auteur et nécessite généralement un paiement. Vous pouvez l'ajouter à vos favoris, mais vous ne pourrez l'utiliser qu'après avoir demandé et obtenu l'autorisation de son auteur. Contactez prosum_solutions pour plus d'informations, ou suivez les instructions de l'auteur ci-dessous.

TradingView ne suggère pas de payer pour un script et de l'utiliser avant d'avoir 100% confiance en son auteur et de comprendre son fonctionnement. Dans de nombreux cas, vous pouvez trouver gratuitement une bonne alternative open-source dans nos Scripts communautaires.

Instructions de l'auteur

To request access to this script, either use the "Website" link below or send us a private message (PM) in TradingView. We will respond as soon as possible.

Vous voulez utiliser ce script sur un graphique ?

Avertissement : Veuillez lire avant de demander l'accès.