Skip to content
Home » Posts » Documentation » 3Commas DCA Bot Indicator & Strategy v1

3Commas DCA Bot Indicator & Strategy v1

Table of Contents

Overview

This TradingView (TV) indicator attempt to implement the ASAP deal start condition found in the 3Commas DCA trading bot settings.

YouTube Video Overview

Indicator & Strategy Anatomy

Figure 1 – Indicator Anatomy

Indicator & Strategy Settings

General Info

Figure 2 – General Info Section

Version

The version input is for displaying the published version of the indicator. It is intended to be for informational use only.

This field contains the URL link to the TradingView script homepage. The expectation is that you would copy the value and paste it into your browser’s address bar to navigate to the webpage.

This field contains the URL link to the script’s documentation webpage. The expectation is that you would copy the value and paste it into your browser’s address bar to navigate to the webpage.

Main Settings

Figure 3 – Main Settings Section

Name

This field is equivalent to the “Name” field of the 3Commas Bot Settings page. It can be used to contain the value of the same input on the bot settings page to help correlate the indicator settings to bot settings when dealing with multiple bots.

Bot Type

This field is equivalent to the “Bot Type” field of the 3Commas Bot Settings page. The scripts will only support Single-pair option but it also displays the Multi-pair option for documentation purposes so you can keep track which configurations are for Multi-pair bots.

Exchange Buy Fee (%) & Sell Fee (%)

These fields do not have any equivalent fields on the 3Commas Bot Settings page because they already have the fee schedule integrated into their platform and also TradingView does not make available the fee schedule for a given symbol on the chart.

The value represents the exchange fee that is applied when the limit or market order(s) to buy or sell the asset is filled. The value of this field will be used to offset the Break-Even price on the chart, which the Take Profit and Stop Loss prices are relatively calculated against.

Deal Start Condition

Figure 4 – Deal Start Condition: Open New Trade ASAP

Open New Trade

This field is equivalent to the “Open new trade asap” field of the 3Commas Bot Settings page. Possible values are:

  • ASAP – This option will simulate the ASAP start condition in 3Commas.
  • Trading View Custom Signal – This option will enable the use of the settings in the TV CUSTOM SIGNAL section.

Start Date/Time

The value of this field will set the date and time when the indicator will begin a deal as soon as possible. Nothing will be plotted to the chart before this time frame. When the input is used to specify a date/time that is within the chart’s time range, it will display a label and colored column to visualize the starting point…

Figure 5 – Start Date/Time Label

Stop Date/Time

The value of this field will set the date and time when the indicator will close the active deal as soon as possible. Nothing will be plotted to the chart after this time frame. When the input is used to specify a date/time that is within the chart’s time range, it will display a label and colored column to visualize the ending point…

Figure 6 – Stop Date/Time Label

TV Custom Signal

Figure 7 – TV Custom Signal Section

Chart/Indicator Data Point

Use this input to link to a specific data point on an existing indicator on the chart or any OHLC data point. The value is then used for the ‘Start Deal When‘, ‘Close Deal When‘ or ‘The Value Of‘ inputs in defining the eligibility condition.

Fix N/A Values

When checked, the indicator will get the last know value from the Chart/Indicator Data Point only when the current value n/a. This is useful when linking to existing indicators on the chart that are configured for a time frame that is higher than the current chart, thus it is possible that the current bar’s value is n/a.

[✓] ───────Enable Start Deal Signal───────

When checked, the start deal rules defined in the inputs below are active and will be used for determining if a Deal Start signal is to be executed.

Start Deal When

The value of this field will define what data point in the indicator or chart is to be used in the comparison condition. Possible values are:

  • Chart/Indicator Data Point – The current value of the selected data point in the Chart/Indicator Data Point input.
  • open – The open price of the current candle.
  • high – The high price of the current candle.
  • low – The low price of the current candle.
  • close – The close price of the current candle.
  • hl2 – The average of the high and low price of the current candle.
  • hlc3 – The average of the high, low, and close price of the current candle.
  • ohlc4 – The average of the open, high, low, and close price of the current candle.

Is

The value of this field will define the operator to use when comparing the data points in the indicator or chart. Possible values are:

  • Greater than – uses the > operator.
  • Less than – uses the < operator.
  • Between – uses the >= and <= operators.
  • Not between – inverts the result of using the Between operators.
  • Equal to – uses the == operator.
  • Not equal to – uses the != operator.
  • Crossing – uses the ta.cross() function from Pine Script.
  • Crossing over – uses the ta.crossover() function from Pine Script.
  • Crossing under – uses the ta.crossunder() function from Pine Script.

The Value Of

The value of this field will define the data point in the indicator or chart to use in the comparison condition. Possible values are:

  • Chart/Indicator Data Point – The current value of the selected data point in the Chart/Indicator Data Point input.
  • Custom Value(s) – The value to test will come from the Custom Value 1 and/or Custom Value 2 inputs.
  • open – The open price of the current candle.
  • high – The high price of the current candle.
  • low – The low price of the current candle.
  • close – The close price of the current candle.
  • hl2 – The average of the high and low price of the current candle.
  • hlc3 – The average of the high, low, and close price of the current candle.
  • ohlc4 – The average of the open, high, low, and close price of the current candle.

Custom Value 1 (Single or Lower Bound)

Defines the single or lower bound value (range comparison) to use as the criteria when testing the Chart/Indicator Data Point value. Only required when the The Value Of input value is “Custom Value(s)“.

Custom Value 2 (Upper Bound Only)

Defines the upper bound value (range comparison) to use as the criteria when testing the Chart/Indicator Data Point value. Only required when the The Value Of input value is “Custom Value(s)” AND the ‘Is‘ input value is set to “Between” or “Not Between“.

Ignore Value

When checked, an additional check is made to ignore the given value when evaluating the rule condition. This is particularly useful when you are evaluating a range of values, like -10 to 10, but you want to ignore value 0 (zero) in the rule condition

Trigger

Defines when to accept the signal from the provider. Possible values are:

  • Once Per Bar
  • Once Per Bar Close

Once Per Bar triggers an alert whenever conditions are met (no more than once per bar).

Once Per Bar Close is the same as above, but the bar is required to close for an signal to be accepted.

[✓] ───────Enable Close Deal Signal ───────

When checked, the close deal rules defined in the inputs below are active and will be used for determining if a Deal Close signal is to be executed.

Close Deal When

The value of this field will define what data point in the indicator or chart is to be used in the comparison condition. Possible values are:

  • Chart/Indicator Data Point– The current value of the selected data point in the Chart/Indicator Data Point input.
  • open – The open price of the current candle.
  • high – The high price of the current candle.
  • low – The low price of the current candle.
  • close  – The close price of the current candle.
  • hl2 – The average of the high and low price of the current candle.
  • hlc3 – The average of the high, low, and close price of the current candle.
  • ohlc4 – The average of the open, high, low, and close price of the current candle.

Is

The value of this field will define the operator to use when comparing the data points in the indicator or chart. Possible values are:

  • Greater than  – uses the > operator.
  • Less than  – uses the < operator.
  • Between  – uses the >= and <= operators.
  • Not between  – inverts the result of using the Between operators.
  • Equal to  – uses the == operator.
  • Not equal to  – uses the != operator.
  • Crossing  – uses the ta.cross() function from Pine Script.
  • Crossing over  – uses the ta.crossover() function from Pine Script.
  • Crossing under  – uses the ta.crossunder() function from Pine Script.

The Value Of

The value of this field will define the data point in the indicator or chart to use in the comparison condition. Possible values are:

  • Chart/Indicator Data Point – The current value of the selected data point in the Chart/Indicator Data Point input.
  • Custom Value(s) – The value to test will come from the Custom Value 1 and/or Custom Value 2 inputs.
  • open  – The open price of the current candle.
  • high – The high price of the current candle.
  • low – The low price of the current candle.
  • close  – The close price of the current candle.
  • hl2 – The average of the high and low price of the current candle.
  • hlc3 – The average of the high, low, and close price of the current candle.
  • ohlc4 – The average of the open, high, low, and close price of the current candle.

Custom Value 1 (Single or Lower Bound)

Defines the single or lower bound value (range comparison) to use as the criteria when testing the Chart/Indicator Data Point value. Only required when the The Value Of input value is “Custom Value(s)“.

Custom Value 2 (Upper Bound Only)

Defines the upper bound value (range comparison) to use as the criteria when testing the Chart/Indicator Data Point value. Only required when the The Value Of input value is “Custom Value(s)” AND the ‘Is‘ input value is set to “Between” or “Not Between“.

Ignore Value

When checked, an additional check is made to ignore the given value when evaluating the rule condition. This is particularly useful when you are evaluating a range of values, like -10 to 10, but you want to ignore value 0 (zero) in the rule condition

Trigger

Defines when to accept the signal from the provider. Possible values are:

  • Once Per Bar
  • Once Per Bar Close

Once Per Bar triggers an alert whenever conditions are met (no more than once per bar).

Once Per Bar Close is the same as above, but the bar is required to close for an signal to be accepted.

Strategy

Figure 7 – Strategy Section

Initial Capital (Indicator Only)

This field is only present for the Indicator version because the Strategy version has the Initial Capital field defined in the Properties tab.

The capital used by the script when back-testing and forward testing on real-time data.

Max Active Deals

This field is equivalent to the “Max active deals” field of the 3Commas Bot Settings page.

This field has no effect on the script performance and is simply here for documentation purposes.

Strategy

This field is equivalent to the “Strategy” field of the 3Commas Bot Settings page.

This field defines the strategy the bot is to use. Options include Long and Short.

Profit Currency

This field is equivalent to the “Profit Currency” field of the 3Commas Bot Settings page.

This field has no effect on the script performance and is simply here for documentation purposes.

Base & Safety Order Size Unit

Specify the unit for the “Base Order Size” and “Safety Order Size” inputs. Given a symbol of BTC/USDT, BTC is considered the “Base“, USDT is considered the “Quote“. A value of “% Quote” will treat the values as percentages (%) of the Initial Capital value plus the Net Profit value that is accumulated throughout the back testing (a.k.a. Compounding).

Base Order Size

This field is equivalent to the “Base order size” field of the 3Commas Bot Settings page.

Define the size of the first starter order.

Start Order Type

Defines the order type to use for the base order.

This input is only here to echo the exact setting in the bot settings page for documentation purposes only. This input will not affect the indicator performance in any way

Safety Orders

Figure 8 – Safety Order Section

Safety Order Size

This field is equivalent to the “Safety order size” field of the 3Commas Bot Settings page.

The size of the following averaging orders.

Price Deviation To Open Safety Orders (% From Initial Order)

This field is equivalent to the “Price deviation to open safety orders (% from initial order)” field of the 3Commas Bot Settings page.

Defines the step in percentage between safety orders.

Max Safety Trades Count

This field is equivalent to the “Max safety trades count” field of the 3Commas Bot Settings page.

The maximum amount of safety orders the bot can use for one deal.

Max Active Safety Trades Count

This field is equivalent to the “Max active safety trades count” field of the 3Commas Bot Settings page.

Defines the amount of Safety Orders the bot is allowed to place in advance on the exchange’s order book for the asset being traded.

Note: This input is only here to echo the exact setting in the bot settings page for documentation purposes only. This input will not affect the indicator performance in any way.

Safety Order Volume Scale

This field is equivalent to the “Safety order volume scale” field of the 3Commas Bot Settings page.

Defines the value of this field defines the volume of each next safety order will be multiplied by this value.

Safety Order Step Scale

This field is equivalent to the “Safety order step scale” field of the 3Commas Bot Settings page.

Defines the value of this field defines the step between each next safety order will be multiplied by this value.

Take Profit

Figure 9 – Take Profit Section

Take Profit (%)

This field is equivalent to the “Take profit (%)” field of the 3Commas Bot Settings page.

Defines how much profits the bot should make from each deal. All exchange fees are included automatically.

Take Profit Type

This field is equivalent to the “Take profit type” field of the 3Commas Bot Settings page.

If you configure the “percentage from base order” setting, the value of the profit will remain the same and will be calculated from the initial Base Order size. For example: Base Order $10, Take Profit 10% means that the profit will be $1 regardless of the amount of Safety Orders executed.

Alternatively, to calculate the Take Profit target percentage using the Dollar Cost Average price of the asset being traded, use the “percentage from total volume” setting, this will increase the value of the amount of profit taken if the deal uses multiple safety orders.

Trailing Deviation

This field is equivalent to the “Trailing deviation” field of the 3Commas Bot Settings page.

When checked, the indicator will trail behind the price action at a specific deviation percentage once the “Take Profit %” is reached, which acts as a trigger. This value should not exceed the “Take Profit %“, otherwise it’s possible to close the deal in a loss.

Set TP to Breakeven, after Safety Order No.

This field has no equivalent field on the 3Commas Bot Settings page. As a result, make sure to use the Close Deal Signal to ensure your position is closed from the indicator TradingView alert.

When checked, the indicator will adjust the Take Profit price to the Breakeven price after the safety order number that is provided is filled. For example, if you supply a value of 5 for this input then once Safety Order #5 is filled, the new Take Profit price will be the Breakeven price. Additional safety orders that are filled afterwards, will continue to use the Breakeven price for the Take Profit price

Set TP to __ %, on bars in deal __

This field has no equivalent field on the 3Commas Bot Settings page. As a result, make sure to use the Close Deal Signal to ensure your position is closed from the indicator TradingView alert.

When checked, the indicator will adjust the Take Profit price to the given percentage at the given number of bars in a deal has been reached. For example, if you supply a value of 0 for the new Take Profit percent and the number of bars in deal as 100 then the indicator will adjust the Take Profit price to be at breakeven when the 100th bar in a deal has been reached.

Figure 10 – Set TP to 0%, on bars in deal of 100 Example

When price is beyond new TP price, then __

When using the previous field setting, a choice has to be made on the possible scenario that the current price action is beyond the new Take Profit price that was calculated. Possible values are:

  • close position immediately
  • set stop loss at new TP price

Close position immediately means that the script will market close the position immediately without delay.

Figure 11 – Close immediately example

Set stop loss at new TP price means that the script will enable the Stop Loss setting (if disabled) and set the stop loss price to be equal to the new calculated Take Profit price and continue the current position until either the Take Profit or Stop Loss price has been reached to close the position.

Figure 12 – Stop loss enabled and set to new TP price.

Stop Loss

Figure 13 – Stop Loss Section

Stop Loss (%)

This field is equivalent to the “Stop Loss (%)” field of the 3Commas Bot Settings page.

When checked, the bot will close deals in a loss when the price drops to or more than configured level. The bot calculates stop loss level from the base order price, not average deal entry price.

Stop Loss Action

This field is equivalent to the “Stop Loss action” field of the 3Commas Bot Settings page.

The bot can do different actions when the stop loss is triggered. Changing this setting doesn’t affect already opened deals. You should edit active deals individually when want to change the stop loss action.

Stop Loss Timeout (bars)

This field is equivalent to the “Stop Loss timeout” field of the 3Commas Bot Settings page.

The bot will perform an additional check when the price reaches Stop Loss price. After the specified amount of bars passes, the bot will check if the price is still below Stop Loss price. If yes, the bot closes the deal by market order. If not, the deal remains active.

Note: 3Commas uses seconds as the unit for this input, but this cannot be simulated in TradingView because to do so will require code that will make the indicator susceptible to repainting.

Advanced Settings

Figure 14 – Advanced Settings Section

Don’t start deal(s) if the daily volume is less than

This field is equivalent to the “Don’t start deal(s) if the daily volume is less than” field of the 3Commas Bot Settings page.

When checked, the bot won’t open a new deal until the coin has more volume for the last 24 hours than entered here. Specified in Base units. Minimum value is 0 and the maximum unlimited.

Note: On charts with resolution times lower than one day, the indicator will calculate the number of historical bars to use to sum the volume to be roughly equal to 24 hours. On charts with resolutions times greater than or equal to one day, the indicator will simply use the previous bar’s volume value.

Minimum Price to Open Deal

This field is equivalent to the “Minimum price to open deal” field of the 3Commas Bot Settings page.

When checked, the bot won’t open a new deal if the current price is lower than the value specified. Minimum value is 0 and the maximum unlimited.

Maximum Price to Open Deal

This field is equivalent to the “Maximum price to open deal” field of the 3Commas Bot Settings page.

When checked, the bot won’t open a new deal if the current price is higher than the value specified. Minimum value is 0 and the maximum unlimited.

Cooldown Between Deals (bars)

This field is equivalent to the “Cooldown between deals” field of the 3Commas Bot Settings page. Instead of measuring seconds, it will count the number of bars on the chart.

When checked, the bot will wait this amount of bars after the deal is completed before starting a new trade. Minimum value is 0 and the maximum is 48.

Open Deals & Stop

This field is equivalent to the “Open deals & stop” field of the 3Commas Bot Settings page.

When checked, the bot will stop after completing the set number of deals. Minimum value is 0 and the maximum unlimited.

Simultaneous Deals Per Same Pair

This field is equivalent to the “Simultaneous deals per same pair” field of the 3Commas Bot Settings page.

This field has no effect on the script performance and is simply here for documentation purposes.

Verify Price For Limit Orders (ticks)

This field has NO equivalent to the fields on the 3Commas Bot Settings page.

When checked, the indicator only considers limit orders filled when prices move a certain number of ticks past the limit price.

Override Minimum Tick Precision

This field has NO equivalent to the fields on the 3Commas Bot Settings page

Defines the exchange’s price precision of the quote currency. The Break-even, Take Profit, Stop-loss and DCA layer prices will be adjusted according to the supplied precision value. There are 10 possible options:

  • None – Using this option will simply default the precision to be the same as the syminfo.mintick value.
  • 0.1 (tenth)
  • 0.01 (hundredth)
  • 0.001 (thousandth)
  • 0.0001 (ten thousandth)
  • 0.00001 (hundred thousandth)
  • 0.000001 (millionth)
  • 0.0000001 (ten millionth)
  • 0.00000001 (hundred millionth)
  • Custom – Using this option will require the Custom Tick Precision input to be used.

Custom Tick Precision

Defines the custom precision to use for price levels on the indicator. Some exchanges require a precision of 0.05 cents in USD, thus you would enter 0.05 into this field. The minimum value is 0 and the maximum is 5. A value of 0 will disable the use of this setting.

Method To Adjust To Precision

Defines the method to use when adjusting price precision. There are two possible values:

  • Truncate – This option will cause the indicator to simply remove all values after the precision position.
  • Round – This option will round the last signification position using the number value of the digit after the position. For example. if the precision is 0.01, then the value 1.015 will round to 1.02.

Close Deal After Timeout

Figure 15 – Close Deal After Timeout Section

Close Deal After Timeout

This field is equivalent to the “Close deal after timeout” field of the 3Commas Bot Settings page.

When checked, it will close the deal automatically, whether in profit or loss, if it hasn’t reached the Take Profit target configured.

The Time After Which, Deal Will Be Closed Automatically (In Bars)

This field is equivalent to the “The time after which, deal will be closed automatically” field of the 3Commas Bot Settings page.

Since the indicator cannot implement a timer like 3Commas (Min, Hrs, or Days), the unit is the number of bars for the current chart resolution that is allowed to elapse until the deal is closed automatically, whether in profit or loss, if it hasn’t reached the Take Profit target configured.

Any Alert() Function Call Settings (Indicator Only)

This section will cover inputs on the indicator version of the script that are not found on the strategy version.

Figure 16 – Alert Settings Section

Warning: This indicator uses the “barstate” variables therefore it will cause a repaint warning when creating alerts.

This is simply a warning message. The check-box has no function influence to the performance of the script.

TradingView has published documentation stating that the use of the barstate variables in any script will provoke a Warning message to display when creating an alert

Figure 17 – Warning about Repaint

Bot ID

After creating the bot on the 3Commas New Bot settings page, the My Bots page will display the Id for the bot. That is the value you supply to this field.

This field supports a comma-delimited list of values that will be parsed and be used in thei respective placeholders. If only a single value is used, you can use the {{bot_id}} placeholder for the value of the “Open Deal Signal Message” and “Close Deal Signal Message” inputs. Otherwise, placeholders like {{bot_id_1}}, {{bot_id_2}}{{bot_id_10}} and beyond can be used in the “Open Deal Signal Message” and “Close Deal Signal Message” inputs.

In order to properly use multiple Bot IDs, you will need to use the JSON array format, like this:

Figure 18 – Example of Multiple Bot IDs and JSON Array Message

Email Token

In “My Bots” tab, click the “view” icon next to your new bot. Scroll down and find the custom texts for TradingView alerts. You should see the email_token value in the “Deal Start Signal” or “Close order at Market Price” message.

The value of this field is then used to support the {{email_token}} placeholder for the value of the “Open Deal Signal Message” and “Close Deal Signal Message” inputs.

Use Custom Symbol

When checked, the indicator will use the symbol value provided to support the {{symbol}} placeholder. If not checked, the indicator will format the chart symbol as QUOTE_BASE for the {{symbol}} placeholder.

Open Deal Signal Message

When checked, the value of this input will be used as the message that is sent when the Open Deal alert triggered in the indicator. The default value is:

{"message_type":"bot","bot_id":"{{bot_id}}","email_token":"{{email_token}}","pair":"{{symbol}}","delay_seconds":0}

Close Deal Signal Message

When checked, the value of this input will be used as the message that is sent when the Close Deal alert triggered in the indicator. The default value is:

{"action":"close_at_market_price", "message_type":"bot","bot_id":"{{bot_id}}","email_token":"{{email_token}}","pair":"{{symbol}}","delay_seconds":0}

Safety Order Filled Message

When checked, the value of this input will be used as the message that is sent when the Safety Order Filled alert triggered in the indicator. The default value is:

{"action":""add_funds_in_quote OR add_funds_in_base", "message_type":"bot","bot_id":"{{bot_id}}","email_token":"{{email_token}}","pair":"{{symbol}}","delay_seconds":0, "volume": {{safety_order_quote_volume}},"amount": {{safety_order_base_amount}}}

Custom Placeholders for Alert Messages

Each of the above inputs support custom placeholders that will be replaced with their real-time values before the message notification is sent out from TradingView. The supported placeholders are:

PlaceholderDescription
{{bot_id}}It will be replaced with the exchange name inherited from the chart using the syminfo.prefix variable value from the Pine Script language.
{{email_token}}It will be replaced with the value of the Email Token input.
{{base_currency}}It will be replaced with the base currency inherited from the chart, e.g. “BTC”, if the chart symbol is BTCUSD.
{{quote_currency}}It will be replaced with the base currency inherited from the chart, e.g. “USD”, if the chart symbol is BTCUSD.
{{symbol}}using either the value in the Use Custom Symbol input or the chart’s base and quote currency formatted as QUOTE_BASE.
{{event_name}}It will be replaced with the name of the event that triggered the alert, e.g. “Open Deal”, “Close Deal”, or “Safety Order Filled”.
{{base_order_price}}It will be replaced with the base order price value.
{{break_even_price}}It will be replaced with the break even price value.
{{take_profit_price}}It will be replaced with the take profit price value.
{{stop_loss_price}}It will be replaced with the stop loss price value.
{{count_of_filled_safety_orders}}It will be replaced with the current number of safety orders that have been filled.
{{safety_order_quote_volume}}It will be replaced with the quote volume that was used for the layer entry.
{{safety_order_base_amount}}It will be replaced with the base quantity that was used for the layer entry.

Chart Settings

Figure 19 – Chart Settings Section

Show Safety Order Lines, Prices, Fill Shapes, and Color

When checked, the safety order prices will appear on the DCA levels for the most recent open deal. Also, the triangle cross shapes will appear when price action crosses a safety order DCA level. You can also control the visibility of the price and triangle shapes as well as the color.

Show Profit/Loss Zones

When checked, the profit and loss zones will be visible; green for the profit zone and red for the loss zone.

Figure 20 – Profit/Loss Zones

Show Unrealized Profit/Loss Label

When checked, the profit and loss label will be visible on the real-time candle. It will be green when in profit and red when in loss.

Figure 21 – Unrealized Profit/Loss Label

Show Used Amount For Each Step Table

When checked, the table will be made visible.

Figure 22 – Used Amount for Each Step Table

Show Statistics Table

When checked, the 3C-DCA-ASAP Statistic table will be made visible.

Position

Changes the position of the table on the chart using the combination of values in the two drop-downs that are provided:

  • Top, Middle, Bottom
  • Left, Center, Right

Summary, 3Commas, Deal Stats, and Safety Order Stats Sections

Shows or hides the various sections of the table.

Stat Label Font Weight

Changes the font weight for the labels of each of the data points in the table. Available options are: Bold and Normal.

Cell Text Size

Defines the text size of the content in the table. Available options are: tiny, small, normal, large, and huge.

Color Theme

Changes the colors of the Statistics and Used Amount For Each Step tables. The following is the theme colors:

Color NameTradingView DarkTradingView LightMicrosoft Blue MediumTheTradingParrot
Header Background#2A2E39#F0F3FA#4472C4#C9C19B
Header Text#D1D4DC#434651#F1F4F8#262626
Cell Background#131722#FFFFFF#FFFFFF (even)
#D9D9D9 (odd)
#999999 (even)
#CCCCCC (odd)
Cell Border#2A2E39#F0F3FA#2A2E39#2A2E39
Stat Label#D1D4DC#434651#262626#262626
Stat Value#2196F3#2196F3#262626#262626

Examples of theme colors:

Figure 23 – TradingView Dark Theme
Figure 24 – TradingView Light Theme
Figure 25 – Microsoft Blue Medium Theme
Figure 26 – TheTradingParrot Theme

When the value is Custom (see below), the following inputs will be activated to provide the color definition to the various parts of the table:

  • Header Background Color
  • Header Text Color
  • Cell Background Color
  • Cell Border Color
  • Stat Label Color
  • Stat Value Color

The following image demonstrates how the colors are applied to the table:

Figure 27 – Statistics Table Colors

Data Window

Both the Indicator and Strategy versions will output series data values to the chart that are visible in the Data Window of TradingView. This section will describe each data point to help you understand the data conditions within the scripts logic.

Data Points

Figure 28 – Data Window

Bar Index

Each bar (or candle) on the chart is assigned an index number. This data point will display the current bar index. Numbering is zero-based, where the index of the first bar is 0.

24 Hr Volume

Displays the 24 hour volume value that is calculated for the current bar. This is useful for when you enable the “Don’t start deal if the daily volume is less than” input and supply a non-zero value.

The value will be “n/a” is the option is enabled in order to improve script execution performance.

Volume Filter Result

Displays the result of the 24 hour volume test for the current bar. A value of 0 is failed and 1 is success.

Minimum Price Filter Result

Displays the result of the minimum price test for the current bar when the “Minimum price to open deal” is enabled. A value of 0 is failed and 1 is success.

Maximum Price Filter Result

Displays the result of the maximum price test for the current bar when the “Maximum price to open deal” is enabled. A value of 0 is failed and 1 is success.

Cooldown Filter Result

Displays the result of the cooldown bar count test for the current bar when the “Cooldown between deals” is enabled. A value of 0 is failed and 1 is success.

Max Closed Deals Filter Result

Displays the result of the cooldown bar count test for the current bar when the “Open deals & stop” is enabled. A value of 0 is failed and 1 is success.

Stop Loss Timeout Bar Count

Displays the bar count since the stop loss timeout was activated. This is useful to see how the closing of the deal occurs when the Stop Loss Timeout feature is enabled. The chart will also display the count on the chart below each candle that is below the Stop Loss price line. When the candle closes above the Stop Loss price line, the count is set to 0.

Figure 29 – Stop Loss Timeout Count

Close Deals By Custom Signal

Displays the price at which the deal was forcefully closed by the “Close Deal When” condition rule set. In addition to the price, the chart will display a label with a “electric plug” icon (🔌) to indicate the event took place.

Figure 30 – Close Deals By Custom Signal Label

Close Deal After Timeout

Displays the price at which the deal was forcefully closed by the “Close Deal After Timeout” input is enabled. In addition to the price, the chart will display a label with a “hourglass done” icon (⌛) to indicate the event took place.

Figure 31 – Close Deal After Timeout Label

Stop Loss Timeout Reached

Displays the price at which the deal was forcefully closed by the “Stop Loss Timeout” input is enabled. In addition to the price, the chart will display a label with a “hourglass done” icon (⌛) to indicate the event took place.

Figure 32 – Stop Loss Timeout Label

Take Profit Cross (Long)

Displays the price where the triangle down shape (▼) is placed on the chart.

Take Profit Cross (Short)

Displays the price where the triangle up shape (▲) is placed on the chart.

Trailing Take Profit Activated

Displays the price where the x-cross shape (🞬) is placed on the chart.

Trailing Take Profit Cross (Long)

Displays the price where the triangle down shape (▼) is placed on the chart.

Trailing Take Profit Cross (Short)

Displays the price where the triangle up shape (▲) is placed on the chart.

Stop Loss Crossed (Long)

Displays the price where the triangle up shape (▲) is placed on the chart.

Stop Loss Crossed (Short)

Displays the price where the triangle down shape (▼) is placed on the chart.

Stop Loss Timeout Activated

Displays the price where the x-cross shape (🞬) is placed on the chart.

Close Deal By Custom Signal

Displays the price where the x-cross shape (🞬) is placed on the chart.

BE

Displays the Breakeven price for the current bar that is rendered on the chart.

TP

Displays the Take Profit price for the current bar that is rendered on the chart.

TTP

Displays the Trailing Take Profit price for the current bar that is rendered on the chart.

SL

Displays the Stop Loss price for the current bar that is rendered on the chart.

Using the Statistics Table

Both the Indicator and Strategy versions will display the Statistics table that summarizes statistical data points using the price action history of trades. This section will describe each section of the data points to help you understand the performance of the indicator.

Figure 33 – 3C-DCA Statistics Table

Data Points

Name

Displays the value of the Name input along with the Strategy option value in square brackets.

Summary

Displays a summary of the indicator configuration settings that have significant value. The following are the meaning of the abbreviation labels:

  • TP – Take profit (%)
  • BO – Base order size
  • SO – Safety order size
  • OS – Safety order volume scale
  • SS – Safety order step scale
  • SOS – Price deviation to open safety orders (% from initial order)
  • MAD – Max active deals
  • MTSC – Max safety trades count
  • SDSP – Simultaneous deals per same pair

Exchange / Pair / Timeframe

Display the exchange name and symbol for the chart. It uses the syminfo.prefix variable for the exchange name and the the syminfo.ticker variable for the symbol. The timeframe is determined by the current chart setting.

Balance

This field is equivalent to the “Balance” value on the 3Commas Bot Settings page. The value of this field is the same as the Initial Capital input from the Properties tab of the Strategy script and Initial Capital input from the Inputs tab of the Indicator script.

Max Amount for Usage (Based on current rate)

This field is equivalent to the “Max amount for bot usage (Based on current rate)” value on the 3Commas Bot Settings page.

It is an approximate calculation of the capital that is needed to support the Base Order Size and Safety Order Size along with the Max Count, Volume, and Scale setting values using the current market rates at the beginning of the chart. If the value exceeds the Balance value, the indicator will display a warning on the last bar on the chart, like this…

Figure 34 – Max Amount for Usage Warning table

Max Safety Order Price Deviation

This field is equivalent to the “Max safety order price deviation” value on the 3Commas Bot Settings page.

Displays the maximum deviation from the average buy price to the last safety order level. This value is useful to define the Stop Loss value when enabled.

% Of Available Balance To Be Used By The Bot

This field is equivalent to the “% of available balance to be used by the bot” value on the 3Commas Bot Settings page.

Displays the percent of the Balance value that will be needed to the bot to support the base and safety orders as configured.

No. Of Deals Started

Displays a count value of all the deals that were started on the chart.

No. Of Deals Completed

Displays a count value of all the deals that were closed at the Take Profit, Trailing Take Profit, or Stop Loss price points.

Win / Loss Rate %

Displays the result of the following equation: [No. Of Deals Completed In Profit] / [No. Of Deals Started] X 100

Displays the result of the following equation: [No. Of Deals Completed In Loss] / [No. Of Deals Started] X 100

Daily P&L

Displays the average profit or loss percentage per day in deals and also the time period as defined by the Start Date/Time and Stop Date/Time inputs.

The equation for the P&L in deals is: ( ( [Net Profit] / [Initial-Capital] ) X 100 ) / [No-Of-Days-In-Deals]

The equation for the P&L in total is: ( ( [Net Profit] / [Initial-Capital] ) X 100 ) / [No-Of-Days-Between-Start-And-Stop-Date/Time]

Note: On charts with resolution times lower than one day, the indicator will calculate the number of historical bars to use to sum the profits and losses to be roughly equal to 24 hours. On charts with resolutions times greater than or equal to one day, the indicator will simply use the previous bar’s profit/loss value.

Max Drawdown

Displays the maximum drawdown percentage relative to the average buy price that a single deal experienced as well as the Deal # so that you can find the deal using the TradingView back tester since the order names contain the Deal # along with the Safety Order #.

Figure 35 – Deal Number in Signal Name in List of Trades Table

Total Volume

Displays the total volume of the base and quote currencies that was utilized in all the deals. The number is updated after each deal is completed.

No. of Single Bar Entries & Exits

Displays the number of times a single bar entry and exit occurred in the chart history.

There exists a limitation in the TradingView Strategy Tester where it will not support an entry and exit to occur in a single bar. To overcome this issue, the script will also send the “close position” command along with the Take Profit limit order, which is processed by the Strategy Tester on the bar close. Here’s an illustration of this scenario…

Figure 36 – Single Bar Entry and Exit Example

No. of Base Order-Only Deals

Displays the number of deals that completed with only the base order being filled.

Mean, Median, Mode, Min, Max, Std. Dev., and Total Bars In Deals

Displays the mean (average), median (middle value), mode (most frequent value), minimum, maximum, standard deviation, and total of all the bar counts the indicator gathered when it was in a deal. The count will begin at the value of 1 (one) when the Base Order is filled. As each bar is completed, the count will increment by 1 (one) and be reset to zero when the deal is completed. These values will only update as soon as a deal is completed.

In addition, the value will display the number of years, months, weeks, days, hours, minutes, and seconds in parentheses.

Mean, Median, Mode, Min, Max, and Total of Safety Orders Filled

Displays the mean (average), median (middle value), mode (most frequent value), minimum, maximum, and total of all the Safety Orders that were filled. These values will only update as soon as a deal is completed.

No. of Safety Order # Filled

Displays a count value of all the Safety Orders that were filled by level index number. It will also show the ratio and percentage of the number of safety orders cracked to the sum of all safety orders cracked. These values will only update as soon as a deal is completed.

Using the 3C TA Starting Conditions Indicator

The 3Commas TA Start Conditions Indicator v1 indicator can be used to simulate 3Commas bot settings using the built-in indicators. This section will cover the details on how to use the TA Start Conditions indicator.

Setup the 3C TA Starting Conditions

In this example we will setup a Long DCA bot using the RSI-7 and ULT-7-14-28 standalone indicators with the 3C DCA bot to back test results on ETHUSD on a 10 minute chart.

The following are the 3C-TASC settings:

Figure 37 – 3C-TASC Settings

The indicator can be seen showing start deal signals below…

Figure 38 – Chart View with new 3C-TASC Settings

Setup 3C DCA Bot Indicator

Now that the 3C TASC indicator has been set up, we are ready to link it with the 3C DCA Bot indicator.

Open the settings and apply the following changes to the inputs…

Figure 39 – 3C DCA Settings with 3C TASC as a Custom Signal

Some of the values are not clearly seen because they get clipped due to the size of the input, but the following is a summary of the values:

Field NameValue
Open new tradeTrading View Custom Signal
Chart/Indicator Data Point3C-TASC: Start Condition Result
Start Deal WhenChart/Indicator Data Point
IsEqual
The Value OfCustom Value(s)
Custom Value 1 (Single or Lower Bound)1

With these new settings, you can now see the indicator will redraw and demonstrate that the signal is received and will start a new deal…

Figure 40 – Chart view with 3C-TASC sending Start Deal Signals to 3C-DCA

You can further adjust the settings in the 3C-TASC indicator to suit your needs before setting up the bot on 3Commas.

Send me an email when this page has been updated

Leave a Reply

Your email address will not be published.