Skip to content
Home » Posts » Documentation » Price Change Scalping Indicator & Strategy v1

Price Change Scalping Indicator & Strategy v1

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.

YouTube Video Overview

Indicator Anatomy

Figure 1 – Indicator Anatomy

Indicator Settings

General Settings

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.

Link to TradingView Script

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.

Link to Documentation

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.

Price Change Settings

Figure 3 – Price Change Settings

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.

Trade Settings

Figure 4 – Trade Settings Section

Trade 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 – Trade Start Date/Time Label

Trade 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 – Trade Stop Date/Tim Label

Trade Direction

This field defines the trading direction of the strategy. Options include Long Only, Shorts Only, and Both.

Initial Capital (Indicator Only)

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

Entry Order Size

Defines the size of the all the entry order as well as all the DCA layers. The minimum value is 0.00000001 (Satoshi) and the maximum is unlimited.

Unit

Defines the unit of the Entry Order Size value. Possible values are:

  • Contracts (Base Currency) – Defines the Entry Order Size value in units of contracts. Given a symbol of BTC/USDT, BTC is considered the “Base Currency“.
  • Fixed Amount (Quote Currency) – Defines the Entry Order Size value in units of the quote currency. Given a symbol of BTC/USDT, USDT is considered the “Quote Currency“.
  • % Of Initial Capital – Defines the Entry Order Size value as a percentage of the Initial Capital, which will results in a fixed amount in units of the quote currency.

Compounding (% of Initial Capital Only)

When checked, the strategy will use the Initial Capital plus the accumulated Net Profit (also known as Equity). This option is only applicable when using % Of Initial Capital for the Entry Order Size Unit input.

Enter Trade At Percentage From Threshold (%)

Defines the Entry Price relative to the Upper (or LowerThreshold 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.

Take Profit (%)

Defines how much profits the trade should make from each trading session. All exchange fees are included automatically.

Stop Loss (%)

Defines how much loss the trade should allow from each trading session. All exchange fees are included automatically.

Exchange Entry Commission (%)

Defines the commission percentage the exchange will charge for entries. This value will be used to properly offset the Break-even price, which is used to calculate the Take Profit and Stop-loss prices. The minimum value is 0 and the maximum is 5. A value of 0 will disable the use of this setting.

Exchange Exit Commission (%)

Defines the commission percentage the exchange will charge for exits. This value will be used to properly offset the Break-even price, which is used to calculate the Take Profit and Stop-loss prices. The minimum value is 0 and the maximum is 5. A value of 0 will disable the use of this setting.

Trigger Warning Alert On Percent Loss From Entry (%)

Defines the percentage of loss that must be realized to trigger a warning alert.

Override Minimum Tick Precision

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:

  • 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.
  • None – Using this option will simply default the precision to be the same as the syminfo.mintick value.

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 Prices To Minimum Tick 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.

Enable Dollar-Cost Averaging (DCA)

When checked, the inputs below this section will be enabled to implement DCA limit orders for entries.

Order Size Multiplier

Defines the multiplier to use when adjusting the volume size for each subsequent layer after the Entry Order. The minimum value is 0.1 and the maximum is unlimited.

Verify Price For Limit Orders (ticks)

Defines how the limit order is to be considered “filled”. The indicator only considers limit orders filled when prices move a certain number of ticks past the limit price. The minimum value is 0 and the maximum is 1. A value of 0 will disable the use of this setting.

The strategy version will have this same input in the Properties tab, thus make sure these two inputs have the same value.

Layer 1-9

Defines either the percentage or fixed amount to offset relative to the base price. The minimum value is 0 and the maximum is unlimited. A value of 0 will disable the use of the layer.

Adjust Take Profit At Layer 1-9 Cross (%)

Defines the new take profit percentage value to use instead of the value that is defined in the Take Profit Percentage input. This value can be a positive or negative value. Using a negative value will act as a pseudo stop-loss to exit at a loss. A value of 0 will disable the use of this setting.

Enable Trade Eligibility Condition

When checked, the following inputs will be used to evaluate the eligibility of accepting a trade setup when the Price Source crosses over the Upper or Lower Threshold lines.

Chart/Indicator Data Point

Use this input to link to a specific OHLC data point. Possible values are:

  • 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.
  • hlcc4 – The average of the high, low, and the double of the close price of the current candle.

Long Condition

When checked, the following inputs are enabled to be used to evaluate Long setups.

Eligible When

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

  • Chart/Indicator Data Point – The value of the selected data point in the Chart/Indicator Data Point input.
  • Entry Price – The entry price that was established when the candle crossed the threshold price.
  • Layer 1 – The potential price of the first layer if a position was to be created.
  • Last Layer – The potential price of the last layer if a position was to be created.

Is

Defines 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

Defines the data point in the indicator or chart to use in the comparison condition. Possible values are:

  • Chart/Indicator Data Point – The value of the selected data point in the Chart/Indicator Data Point input.
  • Entry Price – The entry price that was established when the candle crossed the threshold price.
  • Layer 1 – The potential price of the first layer if a position was to be created.
  • Last Layer – The potential price of the last layer if a position was to be created.
  • Custom Value(s) – The value to test will come from the Custom Value 1 and/or Custom Value 2 inputs.

Short Condition

When checked, the following inputs are enabled to be used to evaluate Short setups.

Eligible When

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

  • Chart/Indicator Data Point – The value of the selected data point in the Chart/Indicator Data Point input.
  • Entry Price – The entry price that was established when the candle crossed the threshold price.
  • Layer 1 – The potential price of the first layer if a position was to be created.
  • Last Layer – The potential price of the last layer if a position was to be created.

Is

Defines 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

Defines the data point in the indicator or chart to use in the comparison condition. Possible values are:

  • Chart/Indicator Data Point – The value of the selected data point in the Chart/Indicator Data Point input.
  • Entry Price – The entry price that was established when the candle crossed the threshold price.
  • Layer 1 – The potential price of the first layer if a position was to be created.
  • Last Layer – The potential price of the last layer if a position was to be created.
  • Custom Value(s) – The value to test will come from the Custom Value 1 and/or Custom Value 2 inputs.

Any Alert() Function Call Settings

This section is for the Indicator version only.

NOTE: See the Using Alerts in TradingView section for details on how to choose among the two alerts notification framework that TradingView offers.

Figure 7 – Any Alert() Function Call Setting Section

Warning: This indicator uses the “barstate.islast” variable 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 8 – Warning from TradingView when creating an alert

Placeholder 1-3 Name & Value

Defines up to three custom placeholder names and values (constant) that can be used in each of the alert messages. This can be useful for defining special parameters that are constant in nature and would be helpful to not repeat in all the message text boxes, but simply define once and use in all the messages.

Figure 9 – Example of using Placeholder Names and Values with Alert Messages

About Custom Placeholders for Alert Messages

Each of the following 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
{{exchange}}It will be replaced with the exchange name inherited from the chart using the syminfo.prefix variable value from the Pine Script language.
{{ticker}}It will be replaced with the exchange name inherited from the chart using the syminfo.ticker variable value from the Pine Script language.
{{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.
{{event_name}}It will be replaced with the name of the event that triggered the alert, e.g. “Enter Long Position”.
{{entry_price}}It will be replaced with the entry price value.
{{exit_price}}It will be replaced with either the take profit or stop loss 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.
{{layer_1_price}} thru {{layer_8_price}}It will be replaced with the layer price value for the given layer number.
{{entry_quote_volume}}It will be replaced with the quote volume that was used for the first entry.
{{layer_1_quote_volume}} thru {{layer_8_quote_volume}}It will be replaced with the quote volume that was used for the layer entry.
{{entry_base_quantity}}It will be replaced with the base quantity that was used for the first entry.
{{layer_1_base_quantity}} thru {{layer_8_base_quantity}}It will be replaced with the base quantity that was used for the layer entry.

Enter Long Message

When checked, the “Enter Long Position” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{entry_price}}

Exit Long Message

When checked, the “Exit Long Position” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{exit_price}}

Enter Short Message

When checked, the “Enter Short Position” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{entry_price}}

Exit Short Message

When checked, the “Exit Short Position” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{exit_price}}

DCA Layer 1-8 Crossed (Long) Message

When checked, the “DCA Layer 1 Crossed (Long)” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{layer_#_price}}

Take Profit Crossed (Long) Message

When checked, the “Take Profit Crossed (Long)” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{take_profit_price}}

Stop Loss Crossed (Long) Message

When checked, the “Stop Loss Crossed (Long)” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{stop_loss_price}}

DCA Layer 1-8 Crossed (Short) Message

When checked, the “Take Profit Crossed (Short)” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{take_profit_price}}

Take Profit Crossed (Short) Message

When checked, the “Take Profit Crossed (Short)” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{take_profit_price}}

Stop Loss Crossed (Short) Message

When checked, the “Stop Loss Crossed (Short)” event will using the give message value for the alert notification message.

The default value is: {{event_name}} at {{stop_loss_price}}

Chart Settings

Figure 10 – Chart Settings Section

Show Price Source Line

When checked, the Price Source line will appear.

Show Threshold Lines

When checked, the Upper and/or Lower Threshold price lines will appear. The lines depend on the Trading Direction value.

Show Threshold 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 Breakeven Line

When checked, the Breakeven line will appear.

Show Stop Loss Line When DCA is Enabled

When checked, the Stop Loss line will appear.

Show Trade Setup/In-Position Background Color

When checked, the background will change different shades of green or red when the indicator enters into a setup or in-position modes.

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 11 – Unrealized Profit/Loss Label

Show Layer Number Labels

When checked, the layer numbers will appear on the active trading session for the current real-time candle.

Show Statistics Table

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

Bars In Trade Section

Shows or hides the Bars In Trade section of the table.

Layers Crossed Section

Shows or hides the Layers Crossed section of the table.

Table 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

Text Size

Defines the text size of the content in the table. Available options are:

  • tiny
  • small
  • normal
  • large
  • huge

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.

Color Theme

Changes the colors of the table.

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 12 – Data Window

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.

BE

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

SP

Displays the Stop 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.

TP

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

L1 – L8

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

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 13 – 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 14 – Lower Threshold Cross Label Shape

Entry Price Cross

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

Figure 15 – Entry Price Cross Shape

Max Entry Percent Cross

Displays the Max Entry Percent Cross Shape (“X”) for the current bar that is rendered on the chart.

Figure 16 – Max Entry Percent Cross Shape

Take Profit Price Cross

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

Figure 17 – Take Profit Price Cross

Stop Price Cross

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

Figure 18 – Stop Price Cross 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 19 – PCS Statistics Table

Data Points

No. of Trade Sessions

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

Win Rate

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

Loss Rate

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

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

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 trade. The count will begin at the value of 1 (one) when the Entry 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 trade session 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 Layers Crossed

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

No. of Layer # Crosses

Displays a count value of all the DCA Layers that were filled by level index number. It will also show the ratio and percentage of the number of layers crossed to the sum of all layers crossed. These values will only update as soon as a trade session 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 *