Wybór Redakcji
OPEN-SOURCE SCRIPT

Volume Delta Compare [Ticks ~ LTF data]

Zaktualizowano

The "Volume Delta Compare [Ticks ~ LTF data]" publication shows 2 different techniques to show into-depth details of Volume, using Tick and Lower-Time-Frame (LTF) data.

🔶 USAGE

Check for divergences between price and volume movement
snapshot

Check details (why and when a ΔV developed)
snapshot
snapshot

Or if you want to see a lot of data stacked on each other )
snapshot


🔶 CONCEPTS

🔹 Tick vs. LTF data

a Tick is an measure of (upward or downward) movement in price OR volume.
We can use this data by using varip in the code.

Advantage:

• Detail, detail, detail
• Accurate, per tick

Disadvantage:

• Only realtime
• Can reset 'easily' -> loss of data
• Will reset when settings are changed


LTF data, through the request.security_lower_tf() function, measures the OHLCV data per LTF bar

Advantage:

• Access to history when loading a chart
• No 'loss' of data when chart resets

Disadvantage:

• Less detailed
• Less accurate


This script makes it possible to compare the 2 techniques and enables you to show different values.

🔹 Values

There are mainly 3 important values:

• UP volume (uV): volume when price rises
• DOWN volume (dV): volume when price falls
• NEUTRAL volume (nV): volume when price stays the same

From this, additional data is calculated:

• Volume Delta (ΔV): uV minus dV
• Cumulative Delta Volume (cΔV): sum of ΔV

One typical nV is at open: at that moment there isn't a base price to compare with,
so when the first trade doesn't fully fill the first supply (up or down), volume will rise, but price just is 'open', no movement -> no uV or dV.

• Tick data: every volume changement    per tick    will be added to the concerning variable (uV, dV or nV)
• LTF data:  every volume changement of each bar will be added to the concerning variable (uV, dV or nV)

-> this can easily give a difference, for example (Tick vs. 1 minute LTF), when most of the ticks caused a rise of price, but at the last few seconds, a few ticks causes the close to come below open, with Tick data this could give more UP Volume, while LTF data will show 1 value of DOWN Volume.


🔶 EXAMPLES

🔹 Details

In these examples you can see:

• grey line: Total volume (higher precision)

• UP/DOWN/NEUTRAL Volume

• green columns: uV
• orange columns: dV
• blue pillars: nV

• coloured stepline: reflects ΔV

• close > open and  positive ΔV -> green
• close > open but negative ΔV -> fuchsia
• close < open and negative ΔV -> orange
• close < open but  positive ΔV -> bright lime green

• Right side -> indication of used data (Tick/LTF data) + last ΔV

• labels (can be disabled)

Above 0 (only with Tick data): data from EVERY tick (ΔV [ΔP]):
• first the amount of Volume (0 when the amount is very minimal)
• between brackets: price movement

Below 0:
• Σ V: sum of uV, dV and nV, for that bar
• Σ up: sum of uV for that bar
• Σ dn: sum of dV for that bar
• Σ nt: sum of nV for that bar
• Σ P: sum of price movement, for that bar (only at Tick data)


snapshot
(At the right you'll see a new bar just started)

snapshot

Here is a detail of the first second at opening:
snapshot

🔹 Cumulative Volume Delta (CVD)

Difference CVD based on Tick vs. LTF data:
snapshot
snapshot
(horizontal lines added for reference)


🔶 FEATURES

🔹 Minimal plotting of na values

Data window and status line only show what is applicable (tick or LTF data) to diminish clutter of data values:
snapshot

The Tick option has a label above 0 which includes details of every Tick.
If data is added every tick, that label on a 10 minute chart will be filled beyond limitations pretty quickly (string max_length = 4096 limit).
To prevent the script stopping to execute, at a certain limit, this label will stop updating and show the message "Too much data".
snapshot

The label below the 0-line won't reach that limit, so it will keep on updating.
Timeframes closer to 1 second will have less risk to reach that 4096 limit. Details will remain to show in this case.

🔹 Automatic label colour adaption when changing between dark/light mode values

Label background/text-colour will adapt according to the dark/light-mode by using chart.fg_color/chart.bg_color
snapshot
snapshot


🔶 SETTINGS

🔹 Data from: Ticks vs. LTF data

🔹 LTF: Lower Time-Frame for when LTF option is chosen: 1, 5, 10, 15, 30 Seconds or 1 minute

🔹 Also start when bar already has data: only for tick data -> when disabled calculations only start on a new bar.

🔹 CVD, Only show Cumulative Delta Volume: enable to just display CVD

🔹 Colours: colour at the right is for price/volume direction divergences

🔹 Label: choose what you want to display + size labels

🔹 0-line: The label under the 0-line sometimes goes below the chart. this can be adjusted with this setting.
snapshot

Informacje o Wersji
Set LTF default at "1" (minute) since certain plans cannot have access to second-time based timeframes. In that way they still can load the indicator. However, upgrading the plan to Premium, Expert, Elite or Ultimate is necessary to be able to use the LTF second options
Volume Indicatorvolumedelta

Skrypt open-source

W prawdziwym duchu TradingView autor tego skryptu opublikował go jako open source, aby inwestorzy mogli go zrozumieć i zweryfikować. Pozdrowienia dla autora! Możesz go używać bezpłatnie, ale ponowne użycie tego kodu w publikacji podlega Zasadom Regulaminu. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Chcesz użyć tego skryptu na wykresie?


PineCoder: pinecoders.com

- We cannot control our emotions,
but we can control our keyboard -

Wyłączenie odpowiedzialności