Volume Delta Compare [Ticks ~ LTF data]

fikira Wizard 已更新   

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


Check for divergences between price and volume movement

Check details (why and when a ΔV developed)

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


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

• Detail, detail, detail
• Accurate, per tick
• 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

• Access to history when loading a chart
• No 'loss' of data when chart resets
• 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.


🔹 Details

In these examples you can see:

• grey line: Total volume (higher precision)

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

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

Here is a detail of the first second at opening:

🔹 Cumulative Volume Delta (CVD)

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


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

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

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


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

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

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

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。