andre_007

L&S Volatility Index Refurbished

andre_007 Updated   
█ Introduction

This is my second version of the L&S Volatility Index, hence the name "Refurbished".
The first version can be found at this link:

The reason I released a separate version is because I rewrote the source code from scratch with the aim of both improving the indicator and staying as close as possible to the original concept.
I feel that the first version was somewhat exotic and polluted in relation to the indicator originally described by the authors.

In short, the main idea remains the same, however, the way of presenting the result has been changed, reiterating what was said.


█ CONCEPTS

The L&S Volatility Index measures the volatility of price in relation to a moving average.

The indicator was originally described by Brazilian traders Alexandre Wolwacz (Stormer) and Fábio Figueiredo (Vlad) from L&S Educação Financeira.

Basically, this indicator can be used in two ways:

1. In a mean reversion strategy, when there is an unusual distance from it;
2. In a trend following strategy, when the price is in an acceptable region.

As an indicator of volatility, the greatest utility is shown in first case.
This is because it allows identifying abnormal prices, extremely stretched in relation to an average, including market crashes.

How the calculation is done:

First, the distance of the price from a given average in percentage terms is measured.
Then, the historical average volatility is obtained.
Finally the indicator is calculated through the ratio between the distance and the historical volatility.

According to the description proposed by the creators, when the L&S Volatility Index is above 30 it means that the price is "stretched".
The closer to 100 the more stretched.
When it reaches 0, it means the price is on average.



█ What to look for

Basically, you should look at non-standard prices.
How to identify it?
When the oscillator is outside the Dynamic Zone and/or the Fixed Zone (above 30), it is because the price is stretched.

Nothing on the market is guaranteed.
As with the RSI, it is not because the RSI is overbought or oversold that the price will necessarily go down or up.
It is critical to know when NOT to buy, NOT to sell or NOT to do anything.
It is always important to consider the context.



█ Improvements

The following improvements have been implemented.
It should be noted that these improvements can be disabled, thus using the indicator in the "purest" version, the same as the one conceived by the creators.

Resources:

1. Customization of limits and zones:

2. Customization of the timeframe, which can be different from the current one.

3. Repaint option (prints the indicator in real time even if the bar has not yet closed. This produces more signals).

4. Customization of price inputs. This affects the calculation.

5. Customization of the reference moving average (the moving average used to calculate the price distance).

6. Customization of the historical volatility calculation strategy.

- Accumulated ATR: calculates the historical volatility based on the accumulated ATR.
- Returns: calculates the historical volatility based on the returns of the source.

Both forms of volatility calculation have their specific utilities and applications.
Therefore, it is worthwhile to have both approaches available, and one should not necessarily replace the other.
Each method has its advantages and may be more appropriate in different contexts.

The first approach, using the accumulated ATR, can be useful when you want to take into account the implied volatility of prices over time,
reflecting broader price movements and higher impact events. It can be especially relevant in scenarios where unexpected events can drastically affect prices.

The second approach, using the standard deviation of returns, is more common and traditionally used to measure historical volatility.
It considers the variability of prices relative to their average, providing a more general measure of market volatility.

Therefore, both forms of calculation have their merits and can be useful depending on the context and specific analysis needs.
Having both options available gives users flexibility in choosing the most appropriate volatility measure for the situation at hand.

* When choosing "Accumulated ATR", if the indicator becomes difficult to see, there are 3 possibilities:
a) manually adjust the Fixed Zone value;
b) disable the Fixed Zone and use only the Dynamic Zone;
c) normalize the indicator.


7. Signal line (a moving average of the oscillator).

8. Option to normalize the indicator or not.

9. Colors to facilitate direction interpretation.
Since the L&S is a volatility indicator, it does not show whether the price is rising or falling.
This can sometimes confuse the user.
That said, the idea here is to show certain colors where the price is relative to the average, making it easier to analyze.

10. Alert messages for automations.
Release Notes:
Short title corrected.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?