IkkeOmar

Logarithmic Volatility Direction Index [IkkeOmar]

The LVDI is a Mean-Reversion Indicator. it doesn't detect trends and does not give a signal per se.
What it does is tell you if we have a flashcrash based on the price action and volume that is available. It is not always easy to see with the naked eye, so this indicator can help you DCA into an asset in a smarter way, if you couple it with other trend systems.
Think of this indicator like a form of a volatility index.
Inputs:
len and lenWMA are integers representing different lengths for calculations, and src is the data source
Keep in mind that "Length" is the lookback for the WMA, and the Length smooting is the lookback for the SMA of the "volume_weighted".
WMA Calculation
wma_basic = math.log10(ta.wma(src, len))
This calculates the logarithm (base 10) of the Weighted Moving Average (WMA) of the source data over len periods. WMA is a type of moving average giving more importance to recent data. The reason I use log10, is to make it transformative over a longer timeframe. This makes it easier to see the growth direction. I like to use this for crypto, since there is asymetric upside.

Volume Filter:
average_volume = ta.sma(volume, lenWMA)
volume_weighted = math.log10(wma_basic * (volume / math.log10(average_volume)))
Here, the script first calculates the Simple Moving Average (SMA) of the trading volume over lenWMA periods. Then, it computes a volume-weighted value of the WMA, adjusted by the logarithmic ratio of current volume to average volume.
Distance and Score Calculation:
distance = math.log10(src) - math.log10(volume_weighted)
score = math.sign(distance) * math.pow(math.abs(distance), 2)

The script calculates the logarithmic difference between the source data and the volume-weighted WMA. The score is determined by the sign of this distance multiplied by its square. This potentially amplifies the impact of larger distances.

Plotting:
plot(volume_weighted, title="Volume Weighted WMA", color=color.blue, linewidth = 2)
plot(ta.sma(volume_weighted, lenWMA), title="Volume Weighted WMA", color=color.rgb(189, 160, 0))

Mathematical concepts
Weighted Moving Average (WMA):
WMA is a moving average that assigns more weight to recent data points. The idea is that recent prices are more relevant to the current trend than older prices.

Logarithms:
The use of log10 (logarithm base 10) is interesting. Logarithms help in normalizing data and can make certain patterns more visible, especially when dealing with exponential growth or decay.

Volume Weighting:
Multiplying the WMA by the ratio of current volume to average volume (both logarithmic) integrates volume into the analysis. High trading volume can signify stronger market interest and can thus validate price movements.

Distance and Score:
The distance measures how far the current price is from the volume-weighted WMA on a logarithmic scale. The score squares this distance, potentially highlighting large divergences.


Case example
In the case above (which is a low timeframe that shouldn't be your main system) we see the blue line going up before going below the moving average line (orange). This indicates a local bottom zone. Does that mean that we wont go lower? No! What you can do is calculate a zone range.
We have an average line, you can get that from the POC with the VRVP.
Then you take the low and high of that zone and take the average:
(3.17% + 2.33%) / 2 = 2.75%
This means that we expect that the price can fall an additional 2.75%! Low and behold. When you check the same chart as above:
Hope it makes sense!
Stay safe everyone!
Don't hesitate to ask any questions if you have any!

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
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?