Home » Posts » Documentation » Price Change Scalping Indicator & Strategy v1 – 3Commas Edition

Price Change Scalping Indicator & Strategy v1 – 3Commas Edition

Table of Contents

Overview

The Price Change Scalping Indicator uses a price rate of change (ROC) momentum calculation to determine the percent change in price between a defined range of time. The ROC takes the current price and compares it to a price “n” periods ago (user defined). The calculated ROC value is then compared to the Upper Threshold and Lower Threshold values to determine if a trade setup is to be activated. If the threshold is crossed, a trade setup will occur based on the indicator settings.

Entry, Take Profit, and Stop Loss prices are calculated and displayed on the chart. Once the Entry Price is crossed, a long or short position is created (depending on the direction) and once the Take Profit price is crossed, the position is closed.

If the Entry Price is not crossed within a specific number of bars, the trade setup is cancelled, and it will proceed to monitor price changes for the next set up.

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.

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. It is reproduced in the indicator in order to help communicate that the script is not designed for composite 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: PCS 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: PCS

Figure 7 – TV Custom Signal Section

Price Source

Defines the source price to use for the ROC calculation. Options include: Open, High, Low, Close, HL2, HLC3 or OHLC4.

Number of Bars Offset

Define the number of bars in the history for the price change period.

Upper Threshold From Source (+%)

Defines the positive percentage offset from the source price to be used as an upper threshold price for Long entries.

Lower Threshold From Source (-%)

Defines the negative percentage offset from the source price to be used as a lower threshold price for Short entries.

Enter Trade At Percentage From Threshold (%)

Defines the Entry Price relative to the Upper (or Lower) Threshold Price in terms of a percentage. The Entry Price will commence in the bar immediately following the bar that crossed the threshold price.

Maximum Entry Percentage From Threshold (%)

Defines the maximum percentage change from the threshold price to avoid entry on bars that have a severe price change.

Maximum Number Of Bars To Enter Trade

Defines the number of bars to keep the Entry Price line active. If the price action does not cross the Entry Price, it will cancel the trade setup and proceed to monitor for threshold price crossings.

Enable Trade Eligibility Condition

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 Of‘ inputs for both the Long or Short conditions which is dependent on the Strategy input value.

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

Long Condition / Short Condition

When checked, the eligibility rules defined in the inputs below are active and will be used for determining if a trade is eligible to be executed.

Eligible When

Defines what data point in the indicator or chart is to be used in the comparison condition.

Is

Defines the operator to use when comparing the data points in the indicator or chart.

The Value Of

Defines the data point in the indicator or chart to use in the comparison condition.

Custom Value 1 & Custom Value 2

When the ‘The Value Of‘ 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.

Strategy

Figure 8 – Strategy Section

Initial Capital

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

Base Order Size

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

Defines the size of the first starter order.

Safety Order Size

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

Defines the size of the following averaging orders.

Base & Safety Order Size Unit

This field will 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 Gross Profit value that is accumulated throughout the back testing.

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 9 – Safety Order Section

Max Safety Trades Count

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

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

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.

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 10 – 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.

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

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.

Stop Loss

Figure 11 – 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 12 – Advanced Settings Section

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

This field is equivalent to the “Don’t start deal 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

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.

Verify Price For Limit Orders (ticks)

When checked, the indicator only considers limit orders filled when prices move a certain number of ticks past the limit price. Make sure this value is the same as the input in the Properties tab with the same name.

Close Deal After Timeout

Figure 13- 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.

Alert Settings

Figure 14 – Alert Settings Section

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.

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

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 Signal

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

Chart Settings

Figure 15 – Chart Settings Section

Show Source Line

When checked, the price source line will appear on the chart

Shows Threshold Lines & Cross Labels

When checked, the threshold price line will appear. Also, the labels with “L” and “S” will appear when the price action crosses the threshold price indicating a Long or Short setup will be initiated.

Show Safety Order Prices & Crossing Shapes

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.

Show Used Amount For Each Step Table

When checked, the table will be made visible.

Figure 16 – Used Amount for Each Step Table

Show Statistics Table

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

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

Figure 17 – Statistics Table Colors

Table 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 18 – TV Dark Theme
Figure 19 – TV Light Theme
Figure 20 – MS Blue Medium Theme
Figure 21 – TheTradingParrot Theme

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 discribe each data point to help you understand the data conditions within the scripts logic.

Data Points

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

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

Stop Loss Timeout

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

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.

SRC

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

UTP

Displays the Upper Threshold Price for the current bar that is rendered on the chart.

LTP

Displays the Lower Threshold Price for the current bar that is rendered on the chart.

NTR

Displays the Entry Price for the current bar that is rendered on the chart.

Entry Price Cross

Displays the Entry Price Shape (“circle”) for the current bar that is rendered on the chart.

Figure 26 – Entry Price Cross Shape

Entry Price Cancel

Displays the Entry Price Cancel Shape (“X”) for the current bar that is rendered on the chart.

Figure 27 – Entry Price Cancel Shape

Upper Threshold Cross

Displays the Upper Threshold Cross label shape with a “L” (Long) for the current bar that is crossing over the threshold price line.

Figure 28 – Upper Threshold Cross Label Shape

Lower Threshold Cross

Displays the Lower Threshold Cross label shape with a “S” (Short) for the current bar that is crossing over the threshold price line.

Figure 29 – Lower Threshold Cross Label Shape

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.

Table Anatomy

Figure 28 – PCS-3C Statistics Table

Data Points

Symbol

Displays the TradingView™ symbol for the chart. It uses the syminfo.ticker variable for the value.

Minimum Tick

Displays the TradingView™ minimum tick value for the symbol for the chart. It uses the syminfo.mintick variable for the value.

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 29 – 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 Rate %

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

Loss Rate %

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.

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.

Mean, Median, Mode, Min, Max, Std. Dev. Of, 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.

Send me an email when this page has been updated

Leave a Reply

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