Kansas City, MO/US
Experience: Beginner
Platform: NinjaTrader
Trading: Futures
Posts: 18 since Jul 2018
Thanks Given: 35
Thanks Received: 15
|
Alright, I'd like to offer an update here on what I've learned.
First, yes, when comparing today's volatility to volatility in the same instrument some time in the past, it IS advisable to use a volatility metric that is a percentage of price. By and large, volatility is a function of price.
Let's look at an example to understand why:
In the previous image we compare two histograms. The top one is a histogram of the 20 day ATR for ES. The bottom histogram is the 20 day ATR% for ES. ATR% is just the 20 day ATR divided by the price times 100 to make it a percentage.
What we see is that ATR is a much more washed out distribution, it's wider. Whereas, the ATR% distribution is narrower with fewer anomalies.
Let's look at another one. Here's wheat:
Again the top histogram (ATR) has some ugly spikes and really doesn't look like a well-behaved distribution at all.
The bottom histogram is a much more well-formed distribution. This gives us some confidence that our comparisons of volatility for different underlying prices has some merit. By dividing by price we are effectively normalizing the volatility.
If you think about it, this makes sense. Just comparing ATR, you'd expect a washed out distribution as prices go up and down and ATR increases and decreases over time.
With the much more well-behaved ATR% distributions I can now define some volatility zones based on the distribution. For example,
* Quiet: Minimum to Mode (peak)
* Normal: Mode to Mean+0.5 standard deviations
* Volatile: Mean+0.5 standard deviations to 3 standard deviations
* Very Volatile: Above 3 SD
That is somewhat arbitrary and one could experiment with those zones, but it's loosely based on Tharpe's approach.
Calculating ATR% for Futures:
Alright, here's the hard part and the question I was trying to answer with my original post:
How do I calculate ATR% for continuous contracts?
The problem has been articulated earlier in this thread.
The solution was not trivial.
I was correct that you'll need a ratio adjusted continuous contract in order to calculate ATR%.
In NinjaTrader I was able to derive the ratio adjusted continuous contract from the normal panama back-adjusted contract (ES ##-##) and the unadjusted contract (ES 12-18).
Now, NinjaTrader does not make it easy to deal with the adjusted and unadjusted at the same time. I had to use BarRequest to pull ES ##-## and ES 12-18 separately. Then I could loop through bars doing comparisons on adjacent price differences to determine where rollover days occurred and how much the offset was. This allowed me to get a list of ratio multiples from which I could produce the ratio adjusted contract.
If you have questions about this, message me. I don't have time right now to go into more detail.
I calculated the 20 day ATRs from the unadjusted series, multiplied this number by the ratio multiple we got from creating our ratio adjusted contract and then divided by the price in the ratio adjusted contract. Finally, I multiplied by 100 to make it a percentage.
Then I created an indicator to analyze a long history of an instrument and capture its distribution and the basic metrics of that distribution which I stored in a file for that instrument. Here it is for ES:
Then I created an ATRPercent indicator. It plots the ATR%, but also reads the metrics from the file and classifies each bar's volatility based on the historical range of volatility for the instrument. Here is ATR Percent for ES.
Red is volatile. Blue is quiet. Gray is normal.
I hope this offers a roadmap for anyone else who might want to do this.
|