Search | User Listing Vidsite | Calendars | Quotes
Home Page ->  Markets & Methods -> New Looks at Traditional Concepts -> View ThreadLogon (or Register, or Join TradeTight)

You are logged in as a limited-access Guest.To join TradeTight, first read the info in the Organization & Content room, then click the link above. 

1 Timothy 6:6-8 (ESV) … Now there is great gain in godliness with contentment,  for we brought nothing into the world, and we cannot take anything out of the world.  But if we have food and clothing, with these we will be content.


Evaluating Price-Wiggles (Volatility)
Jump to page : 1
Now viewing page 1 [50 msgs/pg]
Jump to room :
JimDean
Posted 5/9/2015 10:40 AM (#6221)
Subject: Evaluating Price-Wiggles (Volatility)



Owner/Admin

Posts: 3925
2000100050010010010010025
Location:
USA: GA, Lawrenceville
Volatility certainly is an important concept in trading. Some trading methods are driven as much or more by volatility-analysis than by price-momentum, etc ... options in particular (historical vs implied volatility ... click here for an indic that deals with those). This thread is not intended for discussion about options considerations, since their time-value and multiple contracts set a different kind of playing-field than we deal with when trading stocks.

I've been spending a lot of time, off and on in the past few years or so studying different ways of measuring how "wiggly" a stock's price is. There are hundreds of different uses for this information ... yet often I think we take a "knee-jerk" approach to it ... sometimes we "automatically" gravitate to "inter-bar" measurements like Std Dev or Variance ... other times we "automatically" choose "intra-bar" measurements like H-L Range or TrueRange. Most times, we just use what "everyone else uses" ... but if five million Martians call a cow's tail a "leg", a cow still actually has only four legs ... that is, the fact that a lot of people (ET's?) believe something to be true doesn't necessarily make it true.

In order to study this, we need to look closely at every aspect of the calculations of each "traditional" calculation, and think about reasons why some other alternative might be better ... not just toss every alternative in a pot, but have a rationale for each, so we can meaningfully test it. Then somehow we need to build some kind of evaluation tool to compare alternatives.
Top of the page Bottom of the page
JimDean
Posted 5/9/2015 11:10 AM (#6222 - in reply to #6221)
Subject: Evaluating Price-Wiggles (Volatility)



Owner/Admin

Posts: 3925
2000100050010010010010025
Location:
USA: GA, Lawrenceville
Two things have intrigued me recently ...
1. what is the "best" averaging method to use for True-Range (TR)?
2. how do True Range and Std Deviation (SD) relate to one another?

To evaluate this, I've created a simple Indicator that plots *normalized* SD (red) and TR (green) on the same scale, their average (gold), as well as the SD/TR ratio (blue). Also, the Indic allows for TR to be averaged in one of seven methods (calc's are slow/inefficient but easy to code up for testing): 1=SMA, 3=WMA, 5=EMA, 7=Wilder's ... where 2,4,6, are averages of the two adjoining methods.

In addition to the plotting, the indic provides a Return value that looks back over the entire history and reports the (simple) Average, Max, or Std Dev of the SD/TR ratio ... this is used to create a Focus List column so that the "scope" of the ratio can be evaluated across many stocks. The final input param controls this.

Finally, I added a "Cap" input (which probably doesn't matter too much), so that the "outlier" cases of the ratio could be capped off before the Avg & SD are affected by them ... if the cap ends up being less that some SD excursion, the plot shows maroon histo's coming down from the top, to show how much higher the SD actually was. This makes the chart somewhat more readable. If Cap is set to zero, it's turned off.

The snapshots below show what the code looks like (registered Participants can download the TXT file), and a sample chart. Don't read a lot into the choices of periods or avg'g methods in the snapshot ... this is a testing tool.

(aJDndSDvsTR FL&chartsnap.png)



(aJDndSDvsTR codesnap.png)



Attachments
Attachments aJDndSDvsTR FL&chartsnap.png (78KB - 2 downloads)
Attachments aJDndSDvsTR codesnap.png (89KB - 2 downloads)
Attachments aJDndSDvsTR.txt (1KB - 11 downloads)
Top of the page Bottom of the page
JimDean
Posted 5/9/2015 2:47 PM (#6223 - in reply to #6222)
Subject: Evaluating Price-Wiggles (Volatility)



Owner/Admin

Posts: 3925
2000100050010010010010025
Location:
USA: GA, Lawrenceville
The snapshot shows the results from one set of param's ... I'm not going to the trouble of creating snaps for all the variations but you can download the code and try it yourself. The snap shows the Nas100, but I later decided to use the DNS1 for testing since it's a bit more representative of the "main" stocks ... DNS1 = Dow 15+20+30 + Nas100 + SP100 ... currently 217 symbols (some overlap of the lists of course).

Note that I've normalized all the results so that they are comparable between stocks. The snap below shows the results of 72 test runs, across the spectrum of periods and MA calc types. All of them use the same list and number of bars and cap. The Max and Min columns are usually the average of the two top and bottom sorted symbols, unless their history was too short or the results were odd (uncommon). I'm using 10, 20 and 40 periods for the most-representative TR avg'g method (4=WMA&EMA avg'd), then I standardize on 20 to compare the other avg'g methods (see chart).

To help simplify things, I'm not playing with how StdDev is calc'd in these tests ... the canned OT function does it using the SMA as the centerline, focusing on the Closing price, without any correction for skew or kurtosis.

The two tables below show different sorting methods of the same 72 tests ... the LHS table sorts by Periods then SWEL (calc method), and the RHS table sorts by SWEL then Pds. Each has two sets of three columns ... Max/Middle/Min values for the Average of the SD/TR values for the DNS1 list across 500 bars, and then the Max/Middle/Min values for the Std Deviation of those SD/TR values as a percentage of the Average SD/TR values ... that is, the percent that the Average ratio typically "swings" over time and various symbols.

There are a number of interesting observations from this:
1. the LHS table "Mid SMA" column is very consistent for a given Pds, regardless of calc method
2. the SD/TR ratio increases about 42% when periods double ... .79*1.42~1.14 & 1.14*1.42~1.61
3. the median StdDev of SD/TR is fairly constant at about 40% (more pds = a bit less StdDev)
4. the max&min StdDev's of SD/TR follow a similar pattern, but varying between ~25% to ~75%
5. the RHS table shows StdDev of SD/TR is a bit lower for StoW methods than for EtoL methods

Conclusions from those observations:

a. There is a fairly consistent pattern in the variation of SD vs TR, from a median-ratio point of view ... a very approx formula can be derived to express that ratio as a function of the periods, relatively independent of the calc-method: SD/TR ratio = Pds/33 +0.44 ... this produces answers that are well within the 40% SD range.

b. Since there is consistently somewhat less StdDev swing using StoW (SMA-WMA) methods than using EtoL (EMA-Wilder) methods, *and* since EtoW calc's require significant extra warmup (3-8x) vs S-W, it would seem advisable from a calc-efficiency and accuracy and stability standpoint to use S-W averaging rather than the "classic" Wilder ATR, or even an EMA of TR. So, instead of ATR, we can use WMA(TR,pds) or SMA(TR,pds), where TR = math.max(C[1],H)-math.min(C[1],L) ... that is: WMA(math.max(C[1],H)-math.min(C[1],L),Pds) or SMA(math.max(C[1],H)-math.min(C[1],L),Pds)

c. It makes sense that SD would flip from being less than TR to greater than TR as periods increase, since the price has more time with longer periods to demonstrate a "swing" from a more-distant centerline ... and that swing will be wider, since a long-period SMA is often pretty frar from the price itself. OTOH, the True Range is just looking at one bar plus the close of the prior one, so the individual diff's aren't dependent on the time window at all.

d. Looking at a bunch of charts (not discussed above but easy when you plot the indicator I provided), we can see that SD has more-extreme excursions than TR, and that sometimes the slope of the SD is going the opposite direction of the slope of the TR. The average of the two is more useful than either of them, as a possible indicator that says to consider entering a trade, in the direction of the general trend, when the gold line has reversed upwards (ie increasing volatility), and has moved some minimum-amount of y-axis points. So, the code could be developed into an entry system.

e. When the gold line slope starts falling off significantly, and has dropped some min-amt of y-axis points, that seems to indicate a significant period of consolidation, or an incipient reversal ... this might be developed into a useful exit rule.

Overall: I'm going to start including an option in my custom routines to use either TR or SD or the average of the two, and use either SMA or WMA or the average of the two for smoothing, in place of where I used to just use "knee-jerk" ATR.

Your comments are welcome.

(aJDndSDvsTR test-results.png)



Attachments
Attachments aJDndSDvsTR test-results.png (35KB - 2 downloads)
Top of the page Bottom of the page
RossKovacs
Posted 5/9/2015 5:17 PM (#6225 - in reply to #6221)
Subject: Evaluating Price-Wiggles (Volatility)



Veteran

Posts: 131
10025
Location:
USA: GA, Snellville
A third option may be Larry Williams' VIX Fix (see the article in the url below) or some variation of it.
In the article, Williams claims that "it is easy to duplicate the VIX for any market — Treasury bonds, gold, silver, soybeans, even individual stocks — with a simple formula."
The formula and examples are given in the article.

https://www.ireallytrade.com/newsletters/VIXFix.pdf

FYI: ireallytrade.com is Larry Williams' web site; he has other free articles and videos available.

Thanks, Ross ... I'll take a look at it!
Top of the page Bottom of the page
JimDean
Posted 5/9/2015 6:20 PM (#6226 - in reply to #6225)
Subject: Evaluating Price-Wiggles (Volatility)



Owner/Admin

Posts: 3925
2000100050010010010010025
Location:
USA: GA, Lawrenceville
I've spent a lot of time today horsing around with this ... I'm planning to develop an indicator that provides efficient and highly flexible calculations related to this, that y'all can use like you use the ATR() or STD() functions now, but with a lot more power. It will include expert evaluations of the slopes and distances-travelled-since-last-extreme as options.

I'll have to come back to this later, but here is a snapshot of the initial comment-spec's and param-list. You'll see some really special new things here ... the "PreSetToUse" and "MsgBoxNoneErrNfo" controls ... I intend to include them with all significant new tools. But more on that, later ;~)

(aJDndRngDev comments-snap.png)



Attachments
Attachments aJDndRngDev comments-snap.png (85KB - 3 downloads)
Top of the page Bottom of the page
MelDickover
Posted 5/10/2015 12:22 PM (#6227 - in reply to #6221)
Subject: Evaluating Price-Wiggles (Volatility)



Veteran

Posts: 155
1002525
Location:
USA: FL, Bradenton
I am going to make a couple of posts about volatility. The first is based on the idea that the price time series is not a Gaussian (Bell Curve) distribution, even though lots of indicators (like Bollinger Bands) calculate things like it is.

There is a transform that converts almost any probability distribution into a Guassian one. It is called the Fisher Transform, and it is calculated like the arctanh(). I am attaching a module that allows you to play with converting various things with the Fisher Transform. The result is much more valid Standard Deviation Bands, and clearer indications of price turns.

The Inverse Fisher Transform converts almost any probability distribution into a square wave - is used to sharpen unclear oscillator lines and other data. I am not including it here since it does not normally apply to volatility. Just know it is very different.

The plot compares price with 20, 2 BBs and the fisher transform with 20,2 bands. Note the price is normalized around zero. The line color changes from black to white or red depending on positive or negative divergence with a linreg(5) of price.

A digression: Ehlers suggests traders not use the WMA at all. He states it was designed by a trader lacking a firm grasp of filter theory in hopes of reducing lag. It has more lag than an equivalent EMA and even poorer attenuation than the equivalent SMA. In short, nothing to recommend it over other moving averages.

Mel

(Fisher.png)



Attachments
Attachments Fisher.png (42KB - 3 downloads)
Attachments EhlersFisherTransform.txt (3KB - 12 downloads)
Attachments eSSFfast.txt (0KB - 8 downloads)
Top of the page Bottom of the page
MelDickover
Posted 5/10/2015 7:23 PM (#6230 - in reply to #6221)
Subject: Evaluating Price-Wiggles (Volatility)



Veteran

Posts: 155
1002525
Location:
USA: FL, Bradenton
eSSFfast

I added it to the orig post ... am cleaning things up

Attachments
Attachments eSSFfast.txt (0KB - 10 downloads)
Top of the page Bottom of the page
MelDickover
Posted 5/11/2015 9:51 AM (#6232 - in reply to #6221)
Subject: Evaluating Price-Wiggles (Volatility)



Veteran

Posts: 155
1002525
Location:
USA: FL, Bradenton
Here are some interesting volatility calculations, useful for options especially.

HistoricalVolatilityCalc replicates the one in Omnitrader.

HistoricalVolatilityIntraday computes the historical Open to Close volatility

HistoricalVolatilityOvernight computes the Open to Close[1] volatility.

Counting intraday spikes can find good day trading candidates, those with big moves during regular trading hours.

Those with overnight volatilty are gap plays.

CheapOrExpensive computes whether an option is cheap or expensive by which of 5 bins in the lookback range IV is. IV is mean reverting, so if it is relatively high, you expect it to drop, and vice versa. A good measure of cheap or expensive is where it is in its range cycle. Here I use five bins. Another measure, less important(IMHO) but still interesting, is whether IV is higher or lower than fair IV. The spikes plotted turn yellow if there is a conflict

Attachments
Attachments HistoricalVolatilityCalc.txt (0KB - 10 downloads)
Attachments HistoricalVolatilityIntraday.txt (0KB - 9 downloads)
Attachments HistoricalVolatilityOvernight.txt (0KB - 9 downloads)
Attachments CheapOrExpensive.txt (1KB - 10 downloads)
Top of the page Bottom of the page
MelDickover
Posted 5/11/2015 9:58 AM (#6233 - in reply to #6221)
Subject: Evaluating Price-Wiggles (Volatility)



Veteran

Posts: 155
1002525
Location:
USA: FL, Bradenton
More volatility stuff in the form of spike charts

RelativeSpread finds big H-L spikes in standard deviations

RelativeTrueRange finds big ATR changes in standard deviations

SpikeChart finds a variety of significant changes
'CCoCOoOCoVLoPV = 0, C[1] to C, equivalent to daily change using EOD data
'CCoCOoOCoVLoPV = 1, C[1] to O, equivalent to Opening Gap using EOD data
'CCoCOoOCoVLoPV = 2, O to C, equivalent to the body of a candle
'CCoCOoOCoVLoPV = 3, V[1] to V, Volume bar-to-bar

SpikeVIXStretch finds possible reversals on you current chart based on VIX spikes

Mel

(Spike charts.png)



Attachments
Attachments Spike charts.png (42KB - 4 downloads)
Attachments RelativeSpread.txt (0KB - 13 downloads)
Attachments RelativeTrueRange.txt (0KB - 10 downloads)
Attachments SpikeChart.txt (3KB - 10 downloads)
Attachments SpikeVIXstretch.txt (1KB - 11 downloads)
Top of the page Bottom of the page
Jump to page : 1
Now viewing page 1 [50 msgs/pg]
( E-mail a Link | Printer Version | Search Room )

Owner of site: Jim Dean -- Forum content is confidential, and may not be distributed without written permission.