OPEN-SOURCE SCRIPT

Volume Delta Trailing Stop [LuxAlgo]

The 'Volume Delta Trailing Stop' indicator uses Lower Time Frame (LTF) volume delta data which can provide potential entries together with a Volume-Delta based Trailing Stop-line.

🔶 USAGE

Our 'Volume Delta Trailing Stop' script can show potential entries/Stop Loss lines
снимок
снимок

A trigger line needs to be broken before a position is taken, after which a Volume Delta-controlled Trailing Stop-line is created:
снимок
снимок

🔶 DETAILS

🔹 Volume rises when bought or sold

🔹 When the opening price appears on the chart, a buy/sell order has been executed.
If that order is less than the available supply of that particular price, volume will rise, without moving the price.

🔹 When the opening price is the same as the closing price, the volume of that bar can be seen as "neutral volume" (nV); nor "up", nor "down" volume.

Example

A buy order doesn't fill the first available supply in the order book. This price will be the opening price with a certain volume.
When at closing time, price still hasn't moved (the first available supply in the order book isn't filled, or no movement downwards),
the closing price will be equal to the opening price, but with volume. This can be seen as "neutral volume (nV)".

🔹 Delta Volume (ΔV): this is "up volume" minus "down volume"

🔹 Standard volume is colored red when closing price is lower than opening price ( = "down volume").

🔹 Standard volume is colored green when closing price is higher OR equal (nV) than opening price ( = "up volume").

снимок

🔹 Neutral Volume

The "Neutral-Volume" is considered "Up-Volume" - setting will dictate whether nV is considered as green 'buy' volume or not.
снимок
снимок

🔶 EXAMPLE

29 July 10:00 -> 10:05, chart timeframe 5 minutes, open 29311.28, close 29313.89

close > open, so the volume (39.55) is colored green ("up volume").
(The Volume script used in the following examples is the open-source publication Volume Columns w. Alerts (V) [LucF] from LucF)
снимок

Let's zoom to the 1-minute TF:
The same period is now divided into more bars, volume direction (color) is dependable on the difference between open and close.
Counting up and down volume gives a more detailed result, it remains in an upward direction though):
снимок
(ΔV = +15.51)

Let's further zoom in to the 1-second TF:
The same period is now divided into even more bars (more possibility for changing direction on each bar)
Here we see several bars that haven't moved in price, but they have volume ("neutral" volume).
(neutral volume is coloured light green here, while up volume is coloured darker green)
When we count all green and red volume bars, the result is quite different:
снимок
(ΔV = -0.35)
In total more volume is found when price went downwards, yet price went up in these 5 minutes.



When we split the green "up volume" into "up" and "neutral", the difference is even higher
(here "neutral volume" is colored grey):
снимок
(ΔV = -12.76; "up" - "down")

🔶 CONCEPTS



🔹 Potential positioning - forming of Trigger-line

When not in position, the script will wait for a divergence between price and volume direction. When found, a Trigger-line will appear:

• at high when a blue bar appears (bullishBear).
• at  low when an orange bar appears (bearishBull).

Next step is when the Trigger-line is broken by close or high/low (settings: Trigger)

Here, the closing price went under the grey Trigger-line -> bearish position:
снимок

🔹 Trailing Stop-line

When the Trigger-line is broken, the Trailing Stop-line (TS-line) will start:

low when bullish position
high when bearish position

You can choose (settings -> Trigger -> Close or H/L) whether close price or high/low should break the Trigger-line

When alerts are enabled ("Any alert() function call"), you'll get the following message:
• 'signal up'  when bullish position
• 'signal down' when bearish position

After that, the TS-line will be adjusted when:
• a    blue    bullishBear  bar appears when in bullish position  ->  lowest   of {low , previous blue bar's high or orange bar's low}
• an orange bearishBull bar appears when in bearish position -> highest of {high, previous blue bar's high or orange bar's low}

снимок
снимок

When alerts are enabled ("Any alert() function call"), and the TS-line is broken, you'll get the following message:
• 'TS-line broken down'  when out bullish  position
• 'TS-line broken up'       when out bearish position
снимок

🔹 Reference Point

Default the direction of price will be evaluated by comparing closing price with opening price.
When open and close are the same, you'll get "neutral volume".

You can use "previous close" instead (as in built-in volume indicator) to include gaps.
If close equals open, but close is lower than previous close, it will be regarded as "down volume",
similar, when close is higher than previous close, it will be regarded as "up volume"

Note, the setting applies for the current timeframe AND Lower timeframe:

Based on: "open" (close - open)
снимок

Based on: "previous close" (close - previous close)
снимок

🔹 Adjustment

When the TS-line changes, this can be adjusted with a percentage of price, or a multiple of "True Range"

Default (Δ line -> Adjustment - 0)
снимок

Δ line -> Adjustment 0.03% (of price)
снимок

Δ line -> Mult of TR (10)
снимок

🔶 SETTINGS

🔹 LTF: choose your Lower TimeFrame: 1S (seconds), 5S, 10S, 15S, 30S, 1 minute)

🔹 Trigger: Choose the trigger for breaking the Trigger-line; close or H/L (high when bullish position, low when bearish position)

🔹 Δ line (Trailing Stop-line): add/subtract an adjustment when the TS-line changes (default: Adjustment):

• Adjustment (default: 0): add/subtract an extra % of price
• Mult of TR                     : add/subtract a multiple of True Range

🔹 Based on: compare closing price against:

open
previous close

🔹 "Neutral-Volume" is considered "Up-Volume": this setting will dictate whether nV is considered as green 'buy' volume or not.

🔶 CONSIDERATIONS

🔹 The lowest LTF (1S) will give you more detail and will get data close to tick data.
However, a maximum of 100,000 intrabars can be used in calculations.
This means on the daily chart you won't see anything since 1 day ~ 86400 seconds. (just over 1 bar)
-> choose a lower chart timeframe, or choose a higher LTF (5S, 10S, ... 1 minute)

🔹 Always choose a LTF lower than the current chart timeframe.

🔹 Pine Script™ code using this request.security_lower_tf() may calculate differently on historical and real-time bars, leading to repainting.
deltavolumeLTFluxalgotrailingstopTrend AnalysistrendtradingtruerangeVolume Indicatorvolumedelta

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?


Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Мои профили:

Отказ от ответственности