Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I'm slowly putting together some tools to help me with volatility analysis in NT7. The attached indicator looks at the period log of returns. The attached chart gives you an idea of what people mean by Volatility Clustering .
The guts of the code is:
That snippet is part of the HistoricalVolatility indicator I've been developing in the Elite section.
I'm posting this here for any suggestions/corrections belore posting it in downloads. On its own it is not that exciting but may be useful as a part of something bigger.
A volatility cluster is related to a fat tail, so I am listening attentively, LOL.
If you print volatility and/or logarithmic returns, this is nice, but what is your intention? I agree that voaltility is important, even if you do not want to calculate option prices. I use volatility for my trading approach in the following ways
1) Keltner Channels, they use the average true range, which is a measure of volatility. I prefer Keltner Channels to Bollinger Bands, as Bollinger Bands are sensitive to both directional bias and volatility (it is a two-in-one indicator).
2) The classic floor pivots use yesterday's range to establish targets, so they use 1-day-volatility.
3) I also use a multiple of ATR as a trailing stop, or to enter pullback trades.
Now thinking about, how to use those log returns. Volatility clustering suggests that you get a better prediction for future volatility if you give more weight to recent volatility, when calculating an average. This could be achieved by replacing the ATR with an EMA of the last true ranges. But can't see how to use log returns for this.
The main application that I would have for log returns is to calculate correlation coefficients for pairs of instruments. You could code an indicator that monitors the log return of two instruments and then plots the correlation between the returns. You could then displace one of the series by one or more periods to find out, whether returns of the first instrument could "predict" returns of the other one, prerequisite to intermarket analysis.
It would be a different formula than what I have been playing with for basic pairs trading, but definately worth looking at. Thank you for that comment.
I started looking at the vol thing because one thing that has worked for me recently is some options swing trading... buying vol when vega drops on an "inside" day during high vol periods, and selling it when vega picks up again a day or five later. Its an opportunistic trade that by definition only presents itself <5% of the time. That would be 12 times per year using daily charts.
Like I said LogReturns might work well as part of something else. In the last chart I posted, I plot the ZScore of the LogReturns and found it interesting. I'll be updating the ZScore code I have in the Elite downloads section with the code I used for the indi above this weekend.
The code for the ATRRainbow indicator is attached. Its one I threw together to compare with other things (like LogReturns) so it could probably be better. I'll post it in the downloads section after my usual comment/rethink period.
It is known that stock markets are asymmetrical (flat peaks and sharp troughs), it follows that (a moving average of) volatility declines in a rising market and increases during declines. The question is, whether volatility produces leading or conincident signals.
For the topping process I could not see any divergences, but for the bottoming process there is a clear divergence that can be seen on the weekly chart. The stock market makes a new low, but volatility (fear) does not reach new highs.
An alternative to historical voloatility would be implied volatility (VIX) or very basic, volume. The force index of Alexander Elder is one of the various indicators that would produce a divergence allowing to identify a low as well.
Comparing ATR (Rainbow) with VIX and force index may show similar results. They can identify climax type situations and produce divergences. So you can use them to identify stock market bottoms or commodity tops, as stock markets from sharp troughs and commodities sharp tops. But they would be unusable to detect stock market tops and commodity bottoms.
Would need to do some backtesting to check whether the divergences give us an edge, and whether ATR can beat VIX and/or volume.
Elders Force Index is a Price+Volume thing I believe. Here is how TOS does it:
Proper IV figures require an option price to calculate I believe, and that is dificult to code (for me) in NT. I can get NT to give me specific options prices if I set them up in Instrument Manager (I do that now with IQFeed), but there are better tools for that. So your reference to the VIX is interesting. If the VIX (and other index IV indexes) is our only source of IV data in NT, that is something to keep in mind.