Skip to content
Home » Posts » Documentation » Quickfingers Luc’s Base Breaking Indicator & Strategy v2.5 – 3Commas Edition

Quickfingers Luc’s Base Breaking Indicator & Strategy v2.5 – 3Commas Edition

Table of Contents

Overview

This TradingView (TV) indicator attempts to implement Quickfingers Luc’s (QFL) Base-Breaking trading methodology for the 3Commas platform. The following content will detail the indicator and strategy usage.

YouTube Video Overview

Indicator Anatomy

Figure 1 – Indicator Anatomy

Indicator 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. The value of the field will represent the specific QFL version the indicator is based upon, but with the 3Commas enhancements.

This field contains the URL link to the TradingView script’s homepage and 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 Section

Open New Trade

This field is equivalent to the “Trading View Custom Signal” field of the 3Commas Bot Settings page. It is reproduced here to refer to the TV CUSTOM SIGNAL: QFL section that is directly below this section which contains all the settings needed to configure the PCS strategy for generating an entry signal.

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: QFL

This section will detail all the fields that are necessary for the QFL v2.5.7 algorithm of the traditional indicator.

Figure 7 – TV Custom Signal: QFL Section

Bars On Left

This field is equivalent to the “Number Of Bars To Use For Price Drop Calculation” of the traditional QFL indicator. The label was shortened to support the inline organization with the “Min. Change %” field next to it.

When using the “Long” value for the Strategy input, this value represents the number of bars that are to be used when measuring the price change to the left of the pivot low point.

When using the “Short” value for the Strategy input, this value represents the number of bars that are to be used when measuring the price change to the left of the pivot high point.

Min. Change %

This field is equivalent to the “Minimum Price Drop (%)” of the traditional QFL indicator. The label was shortened to support the inline organization with the “Bars On Left” field before it.

When checked, the field defines the minimum price change percentage value that will be used to measure the price drop and enforce the requirement to be at least this much to accept the pivot point as a base price. When not checked, no price drop calculation will be used at all. As long as the bars on the left of the pivot point are ascending (short) or descending (long), then it will be considered acceptable.

Bars On Right

This field is equivalent to the “Number Of Bars To Use For Price Bounce Calculation” of the traditional QFL indicator. The label was shortened to support the inline organization with the “Min. Bounce %” field next to it.

When using the “Long” value for the Strategy input, this value represents the number of bars that are to be used when measuring the price change to the right of the pivot low point.

When using the “Short” value for the Strategy input, this value represents the number of bars that are to be used when measuring the price change to the left of the pivot high point.

Min. Change %

This field is equivalent to the “Minimum Price Bounce (%)” of the traditional QFL indicator. The label was shortened to support the inline organization with the “Bars For Bounce” field before it.

When checked, the field defines the minimum price change percentage value that will be used to measure the price bounce and enforce the requirement to be at least this much to accept the pivot point as a base price. When not checked, no price bounce calculation will be used at all. As long as the bars that follow the pivot point are ascending, then it will be considered acceptable.

Illustration of Bars On Left & Right with Min. Change %
Figure 8 – Base Confirmation Using Bars On Left/Right and Min. Change % Settings

Volume Factor

This field is equivalent to the “Volume Must Be This Many Times Above Its MA” of the traditional QFL indicator. The label was shortened to support the inline organization with the “MA Length” field next to it.

When checked, the volume at the low pivot point will be compared to the volume moving average using the factor value to determine if the pivot low price is acceptable for a base price. The factor value will be multiplied by the volume moving average value and if the volume exceeds this computed value, it will be a valid base.

MA Length

This field is equivalent to the “Volume MA Length For Above Setting” of the traditional QFL indicator. The label was shortened to support the inline organization with the “Volume Factor” field before it.

The length to use for the volume moving average.

Illustration of Volume Factor & MA Length Settings
Figure 9 – Base Confirmation Using Volume Factor and MA Length Settings

Base Placement

This field is equivalent to the “Anchor Base Line On The Bar’s” of the traditional QFL indicator. The label was shortened to support the inline organization with the “Spacing %” field next to it.

The value of this field will determine where the base line placement will occur once a pivot low (long) or high (short)point has been found. The choices are as follows:

  • Open/Close – For longs, it is the minimum of open or close of the candle. For shorts, it is the maximum of open or close of the candle.
  • High/Low – For longs, it is the low of the candle. For shorts, it is the high of the candle.

Spacing %

This field is equivalent to the “Minimum Percent Change of Price For New Bases (%)” of the traditional QFL indicator. The label was shortened to support the inline organization with the “Base Placement” field before it.

When checked, the field value defines the minimum percentage deviation from the base price that must be exceeded in order to accept the next pivot point. This value is very useful to ensure that when the price action falls below the base price, it will not form a new pivot low point before it can possibly fill the Base Order price level.

The best practice would be to set this value to be the same as either “Open Deal At Deviation From Base (%)” input (if enabled) or the “Price Deviation To Open Safety Orders (% From Initial Order)” input.

Illustration of Spacing %
Figure 10 – Base Confirmation Using Spacing % Setting

Maximum Number Of Cracks Per Base

This field is equivalent to the “Maximum Number Of Cracks Allowed Per Base” of the traditional QFL indicator. The label was shortened to support the inline organization and prevent wrapping to the next line.

When checked, the base price can be limited to the number of times it can be reused.

Open Deal At Deviation From Base (%)

There are no equivalent fields with the traditional QFL indicator. This field is a new enhancement to provide the equivalent feature that is found on 3Commas when using their “QFL” Deal Start Condition, which requires to provide a percentage deviation from the base price.

When checked, the value of this field will define a specific deviation percent below the base price for the Base Order, which will trigger the Open Deal signal alert.

Enable Trade Eligibility Condition

This field is equivalent to the “Enable Trade Eligibility Condition” of the traditional QFL indicator. Use this input to link to a specific data point on an existing indicator on the chart. The value is then used for the ‘Chart/Indicator Data Point‘ value in the ‘Eligible When‘ and ‘The Value‘ inputs.

When checked, the following inputs will be used to evaluate if a base pivot low point is eligible to be plotted and used for setting up a new trade deal.

Chart/Indicator Data Point

This field is equivalent to the “Chart/Indicator Data Point” of the traditional QFL indicator.

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 ‘Eligible When‘ or ‘The Value‘ inputs in defining the eligibility condition.

Eligible When

This field is equivalent to the “Eligible When” of the traditional QFL indicator.

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

Is

This field is equivalent to the “Is” of the traditional QFL indicator.

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

The Value

This field is equivalent to the “The Value Of” of the traditional QFL indicator. The label was shortened to support the inline organization and prevent wrapping to the next line.

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

Custom Value 1 & Custom Value 2

These fields are equivalent to the “Custom Value 1” and “Custom Value 2” of the traditional QFL indicator.

When the ‘The Value‘ input is set to ‘Custom Value(s)‘, this input will define the values to use. If the ‘Is‘ input is set to ‘Between‘ or ‘Not Between‘ then ‘Custom Value 2‘ is required.

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.

Strategy

From this point forward, the inputs will correspond to a form input on the 3Commas bot settings page, with an exception for the Take Profit section. The section includes new inputs that are specific to the QFL v2.5 algorithm.

Figure 11 – 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.

Strategy

This field defines the strategy the bot is to use. Both Long and Short options are available.

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

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 12 – Safety Orders Section

Safety Order Size

The size of the following averaging orders.

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

Step in percentage between safety orders.

Max Safety Trades Count

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

Max Active Safety Trades Count

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

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

Safety Order Step Scale

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

Take Profit

Figure 13 – Take Profit Section

Take Profit (%)

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

Take Profit Type

With percentage from base order, the bot will ignore the total volume of the deal. With the base order size $100 and target profit 5%, the profit will always be $5. With percentage from total volume, the profit will grow as the volume grows.

Trailing Deviation

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.

Adjust Take Profit At Safety Order Cross, SO 01 to 21

This field is equivalent to the “Adjust Take Profit At Layer # Cross (%)” of the traditional QFL indicator. Although, the 3Commas edition supports 21 in total, instead of 9.

When checked, the take profit percentage value can be overridden on a specific safety order crossing. A value of zero will equate to break-even. Using these inputs will require the use of the “Close Deal Signal Message” alert message in order for the indicator to send the signal to close the deal when the take profit price is crossed on the chart. If the alert event is not checked when this option is enabled and at least one of the SO 01 to 21 inputs has a non-zero value, then the following message will display on the chart…

Figure 14 – Adjust Take Profit / Close Deal Signal Message Warning Message

Each input has a minimum value of -100 and the maximum value of +100.

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 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

Figure 15 – 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 16 – 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 17 – Stop loss enabled and set to new TP price.

Stop Loss

Figure 18 – Stop Loss Section

Stop Loss (%)

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

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)

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 19 – Advanced Settings Section

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

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

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

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)

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

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) (Strategy Only)

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 20 – Close Deal After Timeout Section

Close Deal After Timeout

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)

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 21 – Any Alert() Function Call 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 21b – Warning about Repainting

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 22 – 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 alert triggered in the indicator.

Supported placeholders are: {{bot_id}}, {{email_token}}, {{base_currency}}, {{quote_currency}}, and {{symbol}}.

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 alert triggered in the indicator.

Supported placeholders are: {{bot_id}}, {{email_token}}, {{base_currency}}, {{quote_currency}}, and {{symbol}}.

The default value is:

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

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}}}

Chart Settings

Figure 23 -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 24 – 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 25 – Example of Unrealized Profit/Loss Label

Show Used Amount For Each Step Table

When checked, the table will be made visible.

Figure 26 – Used Amount for Each Step Table

Show Statistics Table

When checked, the QFL Statistic table will be made visible.

Vertical Position

Changes the vertical position of the table on the chart. Possible values are:

  • Top
  • Middle
  • Bottom

Horizontal Position

Changes the horizontal position of the table on the chart. Possible values are:

  • Left
  • Center
  • Right

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

Shows or hides the various sections of the table.

Cell Text Size

Changes the text size of all the cells in the table. The value “small” is the default. Available options are:

  • tiny
  • small
  • normal
  • large
  • huge

Color Theme

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

Color NameTV DarkTV LightMS 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 27 – TV Dark Theme
Figure 28 – TV Light Theme
Figure 29 – MS Blue Medium Theme
Figure 30 – 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 31 – QFL 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 32 – Data Window

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.

NSO

Displays the Next Safety Order 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.

Base Marker

Displays a 1 or 0 on the bar that renders the base marker shape ( ▲ ) on the chart.

Base

Displays the Base price for the bars that render the line on the chart.

Next Base

Displays the Next Base price of the bars that render the line on the chart.

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.

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 33 – Stop Loss Timeout Count

Close Deals By Custom Signal

Not used in this indicator.

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 34 – Close Deal After Timeout Label

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 35 – Stop Loss Timeout Label

Using the QFL Statistics Table

Both the Indicator and Strategy versions will display the QFL Statistics tablethat 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.

Table Anatomy

Figure 36 – QFL 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
  • BOS – Open deal at deviation from base (%)

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

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 37 – Max Amount for Usage Warning Label

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 Bases Created

Displays a count value of all the bases that were plotted on the chart, including the Next Base plot series.

Mean / Median / Mode Drop %

Displays the mean (average), median (middle value), mode (most frequent value) of all the price change percentages to the left of the pivot. These values will only update as soon as a base is created.

The price changes are not normally distributed, but rather positively skewed to the right. Therefore, the mean will be greater than the median, likewise the median will be greater than the mode.

Min / Max Drop %

Displays the minimum, and maximum of all the price change percentages to the left of the pivot. These values will only update as soon as a base is created.

Std. Dev of Drop %

Displays the standard deviation of all the price change percentages to the left of the pivot. This value will only update as soon as a base is created.

No. of Drops

Displays the total number of price changes to the left of the pivot. This value will only update as soon as a base is created.

Mean / Median / Mode Bounce %

Displays the mean (average), median (middle value), mode (most frequent value) of all the price change percentages to the right of the pivot. These values will only update as soon as a base is created.

The price changes are not normally distributed, but rather positively skewed to the right. Therefore, the mean will be greater than the median, likewise the median will be greater than the mode.

Min / Max Bounce %

Displays the minimum, and maximum of all the price change percentages to the right of the pivot. These values will only update as soon as a base is created.

Std. Dev of Bounce %

Displays the standard deviation of all the price change percentages to the right of the pivot. This value will only update as soon as a base is created.

No. of Bounces

Displays the total number of price changes to the right of the pivot. This value will only update as soon as a base is created.

Mean Bars from Base Created to Cracked

Displays the mean (average) of the number of bars that elapsed from the bar where the base was created to the bar where the base was cracked (base order filled).

Median Bars from Base Created to Cracked

Displays the median (most frequent value) of the number of bars that elapsed from the bar where the base was created to the bar where the base was cracked (base order filled).

Mode Bars from Base Created to Cracked

Displays the mode (average) of the number of bars that elapsed from the bar where the base was created to the bar where the base was cracked (base order filled).

Min Bars from Base Created to Cracked

Displays the minimum value of the number of bars that elapsed from the bar where the base was created to the bar where the base was cracked (base order filled).

Max Bars from Base Created to Cracked

Displays the maximum value of the number of bars that elapsed from the bar where the base was created to the bar where the base was cracked (base order filled).

Std. Dev. of Bars from Base Created to Cracked

Displays the standard deviation of the number of bars that elapsed from the bar where the base was created to the bar where the base was cracked (base order filled).

No. of Bases Cracked

Displays the number of bases cracked. This value swill be the same as the No. Of Deals Started.

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 38 – Neal 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 39 – Single Bar Entry and Exit Example

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

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 Alerts for 3Commas

The 3Commas website has good instructions for using TradingView™ as a custom signal provider, which you can find here 🡵. The indicator version of the script makes use of TradingView™’s two different alert types to support 3Commas. They are:

  • Alert Condition
  • Alert() function

This section will cover creating alerts for these two types and discuss the pros and cons of each.

Alert Condition

This alert type is the traditional method of creating an alert using an indicator. The dialog looks like this…

Figure 40 – Create Alert dialog for Indicator

The Condition drop-down will contain two alert conditions that the indicator defines. They are 1) Open Deal and 2) Close Deal. Choosing either one will set up the alert to display the Message text area and will require that you enter the 3Commas signal JSON text accordingly. The value will support the standard placeholder that TradingView supports ({{close}}, {{time}}, etc.), but it will not support the custom placeholders that the indicator provides (see Open Deal Signal Message or Close Deal Signal Message sections above for details).

If you want to receive both the Open Deal and Close Deal signals from the indicator, you will need to create an alert for each one using this alert type. If you would like to use only one alert for both Open Deal and Close Deal signals, then use the alert() function type as described in the next section.

Alert() Function Call

This alert type is the new method of creating an alert with an indicator that implements the alert() function. The dialog looks like this…

Figure 41 – Create Alert dialog using Alert() function call

This new alert method is capable of handling all the signals that make use of the alert() function in the script. As a result, one single alert can handle the Open Deal and Close Deal alert events that the indicator may generate. In order to control which events are sent to the alert() function method, you will need to check the checkbox next to the alert message in the indicator settings, like this…

Figure 42 – Open Deal Signal Only

In this screenshot, only the Open Deal signal message will be sent to the alert() function call. As a result, using this alert type is only advantageous if you want to reduce the number of alerts created for the indicator and handle multiple events. Otherwise, using the traditional alert condition type is sufficient.

Another advantage to using this type of alert is to make use of the custom placeholders the indicator provides, which are: : {{bot_id}}, {{email_token}}, {{base_currency}}, {{quote_currency}}, and {{symbol}}.

Helpful Tips

Once you create an alert, TradingView™ will take a snapshot of the indicator’s code and your settings and save it with the alert so that they can successfully run it on their servers and send notifications via Email, SMS, mobile app, or Webhook URLs. As a result, there is no need to do anything special to the indicators to maintain the alerts. But, do keep in mind that changing the indicator settings after creating the alert will NOT update the alert. You will have to delete the alert and recreate it, if you want the new settings to be effective

In addition, indicator settings are stored with the chart, so as you experiment with settings and want to save a specific set of settings, you can save the chart and copy it into a new name for future reference.

Strategy Alerts

DO NOT USE STRATEGY ALERTS TO INTEGRATE WITH 3COMMAS!

Important Note

Please read the Important Note section on TradingView’s Stategy Alerts page 🡵. Specifically, this statement:

Strategies are more susceptible to repainting than indicators because the broker emulator makes assumptions about price movement to simulate orders on historical bars.

Creating Strategy Alerts

The strategy version of the script will only support the order fill events as normal, but the custom placeholders that are supported in the indicator version are NOT supported here. An order fill event is any event generated by the broker emulator which causes a simulated order to be executed.

To create an alert on the strategy version of the script, simply use the strategy’s drop-down menu:

Figure 43 – Strategy Drop-down Menu for Adding an Alert

The following placeholders are supported by TradingView™ for these alerts in the Message text area:

  • {{strategy.position_size}} — returns the value of the same keyword in Pine, i.e., the size of the current position.
  • {{strategy.order.action}} — returns the string “buy” or “sell” for the executed order.
  • {{strategy.order.contracts}} — returns the number of contracts of the executed order.
  • {{strategy.order.price}} —returns the price at which the order was executed.
  • {{strategy.order.id}} —returns the ID of the executed order (the string used as the first parameter in one of the function calls generating orders: strategy.entry, strategy.exit or strategy.order).
  • {{strategy.order.comment}} — returns the comment of the executed order (the string used in the comment parameter in one of the function calls generating orders: strategy.entry, strategy.exit or strategy.order). If no comment is specified, then the value of strategy.order.id will be used.
  • {{strategy.order.alert_message}} — returns the value of the alert_message parameter which can be used in the strategy’s Pine code when calling one of the functions used to place orders: strategy.entry, strategy.exit or strategy.order. This feature is only supported in Pine v4.
  • {{strategy.market_position}} — returns the current position of the strategy in string form: “long”, “flat”, or “short”.
  • {{strategy.market_position_size}} — returns the size of the current position as an absolute value, i.e. a non-negative number.
  • {{strategy.prev_market_position}} — returns the previous position of the strategy in string form: “long”, “flat”, or “short”.
  • {{strategy.prev_market_position_size}} — returns the size of the previous position as an absolute value, i.e. a non-negative number.

Source: https://www.tradingview.com/support/solutions/43000481368-strategy-alerts/ 🡵

Using Trailing Take Profit

This section will review the unique behavior of how the trailing take profit (TTP) feature of the indicator will work so that you are aware of the differences of the actual behavior in 3Commas. A detailed explanation of how 3Commas handles the trailing take profit works can be found here 🡵.

Implementing a trailing take profit (TTP) is unique in TradingView because of how the broker emulator works for historical bars. A detailed explanation can be found here 🡵. Basically, as a result of how the broker emulator works, it is not possible to place a stop order in the same bar where the stop order and bar price overlap. For example, if the bar’s OHLC price encompasses the stop order price, the execution of the order will not occur until the next bar, but that next bar’s price action must cross the stop order price in order for it to be registered as being filled.

Example Scenario

Due to the above being true, the indicator will use the value of the “Trailing TP Deviation” input and measure the deviation relative to the low price of the bar that triggers the TTP.

For example, consider this screenshot…

Figure 44 – Trailing Take Profit Activated and Offsets From Low of Trigger Bar

The value of the “Trailing TP Deviation” input is “1.5“, thus the indicator will start the TTP from the low of the trigger bar. As each bar completes, the price of the TTP will be adjusted to the low of the subsequent bar. The price will remain the same until the 1.5% from the low of the subsequent bar is greater than the current TTP.

As a result of this implementation, it is recommended that people review the historical price action in the chart and ensure that the TP and TTP values are appropriate and not causing a loss in profits when it closes the position. It is good practice to set the TTP deviation value to be less than the TP value so that it can successfully close a position in profit as a result of the TTP not being adjusted when it is triggered.

For example, in the following image, the TTP is triggered, but never adjusted…

Figure 45 – Trailing Take Profit not adjusted but close in profit

Using the Trade Eligibility Condition

The indicator has the ability to link to other indicators on the chart for the purpose of filtering out the entry of a trade. Most common indicators that are used are RSI or EMA/SMA, but additional indicators can be used. The only restriction is that the indicator must supply a single data point to be used to define and test a user-defined condition. If the condition evaluates to true, the indicator will accept the pivot low point as a base price for trading.

200 EMA Example

In this example, we will apply a 200 EMA indicator to the chart and configure the QFL3C indicator to only accept a base when the base price is above the current 200 EMA value.

  1. Use the Indicators & Strategies dialog to ad the Moving Average Exponential indicator.
  2. Configure the EMA to use a higher timeframe and set the “Length” to be 200 with a “Source” value of close. Click the OK button to apply the changes.
  3. Open the QFL3C settings and set the “Chart/Indicator Data Point” drop-down to EMA.
  4. Set the “Eligible When” drop-down to Base.
  5. Set the “Is” drop-down to Greater Than.
  6. Set the “The Value” drop-down to Chart/Indicator Data Point.
  7. Lastly, check the “Enable Trade Eligibility Condition” checkbox and click the OK button to apply the changes.

The inputs should look like this…

Figure 46 – Enable Trade Eligibility Condition for 200 EMA

The interpretation of these settings are to be read as:

“Trading is Eligible When [the] Base Is Greater Than The Value [of the] EMA Indicator Data Point”

RSI Example

In this example, we will apply a RSI indicator to the chart and configure the QFL3C indicator to only accept a base when the RSI is in a specific range of values.

  1. Use the Indicators & Strategies dialog to ad the Relative Strength Index indicator.
  2. Open the QFL3C settings and set the “Chart/Indicator Data Point” drop-down to RSI.
  3. Set the “Eligible When” drop-down to Chart/Indicator Data Point.
  4. Set the “Is” drop-down to Between.
  5. Set the “The Value” drop-down to Custom Value(s).
  6. Set the “Custom Value 1” input to 30 and the “Custom Value 2” input to 70.
  7. Lastly, check the “Enable Trade Eligibility Condition” checkbox and click the OK button to apply the changes.

The input should look like this…

Figure 47 – Enable Trade Eligibility Condition for RSI

The interpretation of these settings are to be read as:

“Trading is Eligible When [the] RSI Indicator Is Between The Value [of] 30 and 70

Send me an email when this page has been updated

1 thought on “Quickfingers Luc’s Base Breaking Indicator & Strategy v2.5 – 3Commas Edition”

  1. Amazing!!! I loved all your hard work. I’m a programmer too. After I read the QFL trading strategy document I thought: I have to translate this strategy into a pine program immediately.
    I’ve done some pine coding before but nothing as serious.

    Then, I found your work that is amazing. I loved it and I’m looking forward to test such amazing thing using 3 commas.

Leave a Reply

Your email address will not be published. Required fields are marked *