IkkeOmar

Logarithmic CVD [IkkeOmar]

IkkeOmar Telah dikemas kini   
The LCVD is another Mean-Reversion Indicator. it doesn't detect trends and does not give a signal per se. However the logarithmic transformation is made to visualize the direction of the trend for the volume. This allows you to see if money is flowing in or out of an asset.
What it does is tell you if we have a flashcrash based on the difference in volume.
Think of this indicator like a form of a volatility index.
Smoothing input:
The only input is an input for the smoothing length of the logDelta.

Volume Calculation:
// @IkkeOmar
//@version=5
indicator('Logarithmic CVD', shorttitle='CVD', overlay=false)
smooth = input.int(defval = 25, title = "Smoothing Distance")

// Calculate buying and selling volume
askVolume = volume * (close > open ? 1 : 0) // Assuming higher close than open indicates buying
bidVolume = volume * (close < open ? 1 : 0) // Assuming lower close than open indicates selling

// Delta is the difference between buying and selling volume
delta = askVolume - bidVolume

// Apply logarithmic transformation to delta
// Adding a check to ensure delta is not zero as log(0) is undefined
logDelta = delta > 0 ? math.log(math.abs(delta)) * math.sign(delta) : - math.log(math.abs(delta)) * math.sign(delta)

// use the the ta lib for calculating the sma of the logDelta
smoothLogDelta = ta.sma(logDelta, smooth)

// Create candlestick plot
plot(logDelta, color= color.green, title='Logarithmic CVD')
plot(smoothLogDelta, color= color.rgb(145, 37, 1), title='Smooth CVD')
These lines calculate the buying and selling volumes. askVolume is calculated as the total volume when the closing price is higher than the opening price, assuming this indicates buying pressure. bidVolume is calculated as the total volume when the closing price is lower than the opening price, assuming selling pressure.
The Delta is simply the difference between buying and selling volumes.

Logarithmic Transformation:
logDelta = delta > 0 ? math.log(math.abs(delta)) * math.sign(delta) : - math.log(math.abs(delta)) * math.sign(delta)
Applies a logarithmic transformation to delta. The math.log function is used to calculate the natural logarithm of the absolute value of delta. The sign of delta is preserved to differentiate between positive and negative values. This transformation helps in scaling the delta values, especially useful when dealing with large numbers.
This script essentially provides a visual representation of the buying and selling pressures in a market, transformed logarithmically for better scaling and smoothed for trend analysis.
Hope it makes sense!
Stay safe everyone!
Don't hesitate to ask any questions if you have any!
Nota Keluaran:
I forgot to add "Logarithmic" to the title. That's the only update lol

Join my community where i share signals and my secret algos:

Telegram:
t.me/ikkeomarfree

I can also help you get $50.000 funded!

Just dm my Telegram @IkkeOmar
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?