Bollingerband: The search for volatility

Usually it makes no sense to fight against normal distribution. But there are setups which have got a high probability of unexpected behavior.  Volatility can be the key to future market movements.

Bollinger bands width percentile

Bollinger Bands are a great tool to describe market volatility. And my favorite tool to measure the width of Bollinger Bands is Bollinger percentile.

Like the IV percentile indicator my Bollinger percentile indicator is a probabilistic indicator. It gives the probability of Bollinger Bands having a narrower upper band – lower band range than currently given.

A Bollinger percentile of 93% (screenshot) means, that in only 7% of the last 1000 trading days Bollinger bands have been wider than they are today.

A Volatility Prognosis

We already had some statistics on how likely the market will be within today’s Bollinger band in a given number of days from now.

This time I would like to find out if the market will be within a market neutral volatility prognosis cone in a given number of days from now.

Bollinger bands are somehow trend following. This comes due to the moving average they are based on. The volatility cone I am testing in this article is market neutral. It has no bullish or bearish offset. I am using Kahler`s volatility to calculate this fair bet vola cone.

Questions:

  1. How likely is the market within the shown volatility cone within 20 days from now?
  2. Can Bollinger Percentile identify areas with a higher/lower probability of being inside/outside of the vola cone?

Outside Kahler`s volatility cone in 20 days from now

First let’s run a test on the probability of the market to be outside the shown fair bet vola cone within 20 daily bars from now.

Running on 10 years of daily data the test shows the expected result; In slightly more than 50% of time the stocks have been outside of the fair bet vola cone.

Bollinger percentile volatility prognosis

Old market wisdom says that after a volatile phase things will calm down. This is the basic idea behind the next tests.

I would like to see if the probability of being in or out of the projected vola cone can be determined by looking at the width of the current Bollinger band.

Running the same test as above, but calculating the results depending on the level of the Bollinger percentile indicator gives a new picture.

If Bollinger percentile is above 50, you got a higher probability of being outside the volatility prognosis in 20 days from now than you would have with a Bollinger percentile below 50. Bollinger percentile above 50 means, that the width of the Bollinger band has been below the current level in more than 50% of the last 250 bars.

The width of the volatility cone itself is not influenced by the width of the current Bollinger band. It’s width is calculated over  the last 1000 daily bars of historic data and does not change a lot over time. The Bollinger band is calculated over 20 days.

On the screenshot above you see the probability of the market of being outside the volatility cone in 20 days from now. The first row of results gives the probability of being outside if Bollinger percentile is above 75%, the second row gives the results for being outside the vola cone when Bollinger percentile is below 25%. As you can see, there is quite a difference.

The results behave opposite to what I would have expected.

A wide Bollinger band does not lead to a higher probability of the market being inside a market neutral vola prognosis. I would have assumed, that if we got a wide Bollinger band, the market would calm down and stay within a range for some days. But the opposite is true.

Takeaways

Depending on your trading style these findings can be used is several ways.

  • If you trade market neutral strategies, the vola projection gives the break even points of a fair priced at the money straddle, you can use these findings to decide if it is better to buy or sell a straddle.
  • If you are trading directional you can use these findings to look for probable breakout scenarios or for placing target/stop orders to make use/protect form unlikely events.

Research pays off, contact me for more details.

Continue reading

IV Percentile – when to sell volatility

You got to know when to hold ’em,
Know when to fold ’em,
Know when to walk away,
And know when to run.
(Kenny Rogers)

Is volatility high or low?

Volatility is a nicely reverting time series. If it is high chances are good that it will come down again. The only problem is to find out when volatility is high, and when it is low. Unfortunately there are no absolute levels, you can’t say that 50% implied volatility is high, as this specific stock might have an implied volatility of 80% most of the time. So you can only compare the current volatility level to historic levels and so define if volatility is currently high or low.

Volatility rank

One simple measure to find out if volatility is high or low would be the volatility rank. It is calculated like the stochastic indicator used in technical analysis. Volatility rank (in %) = (current IV – Min IV)/(Max IV -Min IV). The maximum and minimum of volatility is usually calculated over one year.

But this calculation method has got some major drawdowns. Singular implied volatility spikes will affect the values of the year after, and it will seem that volatility is low, just because it is low relative to this one spike, but not in a broader sense. Also the absolute level has not meaning by itself. 50% would just mean that current IV is 50% of the last spike up.

IV Percentile – a probability based indicator

Unless IV rank, the stochastic like indicator, IV percentile is a probabilistic indicator. It does not give the position of current implied volatility relative to it’s historic levels, it give the probability of IV for being lower than today. So a IV percentile reading of 0 (zero) means, that there has been no IV lower than the current one. This would be a nice setup for buying volatility. It most probably will go up. On the other side, a volatility reading of 93% (as we have it on October 12th after the S&P sell-off means, that on 93% of all days in history volatility has been lower than the current one. You might want to go with the probabilities and sell volatility.

IV percentile does not only give you a level, it also gives you the probability of falling volatility.As soon as IV percentile is above 50 you have a better than 50% chance that volatility will be lower soon. Have a look at the VIX article I did, it comes to a similar conclusion.

Scan for IV Percentile

IV percentile is the perfect indicator for a market scan. Find all stocks with an IV percentile above 50 (look for 85% and higher…) and you will have an edge when selling volatility. As you can see on the chart above, a high IV percentile number also correlates with an implied volatility being above the fair bet volatility. So your edge actually has two legs: (1) current IF is high and will most probably revert down (IV percentile > 50%) and (2) implied volatility is overpriced according to historic measures.

If you add all the edges you can get the luck will be on your side.

Free IV percentile data is available at https://www.optionstrategist.com/calculators/free-volatility-data

Tradesignal IV Percentile Indicator

If you got IV data from your data provider you can use the Tradesignal IV percentile indicator given below.

 

 

 

Implied vs. Realized Volatility for NASDAQ100 stocks

(1) You shall only trade when the chances are on your side

Comparing implied and realized volatility

Selling volatility can be a profitable game, but only if you sold a higher volatility than the market realizes later on. Comparing realized and current implied volatility can give you an idea if the chances are on your side.

We already had a look at realized volatility and what the fair price for a straddle might be. Have a look at the kvolfair bet articles. These articles present a way to calculate the historically correct price for a straddle. Whenever you sell a straddle (to sell volatility), implied volatility should be higher than the fair bet price. Only then you will win on a statistical basis.

VIX and fair bet volatility

The chart above shows the S&P500 implied volatility index VIX and the long term fair bet volatility. Right now VIX is below the 12.5% fair bet yearly volatility, suggesting that it might not be the right time to sell volatility in the S&P500 without further analysis. Statistically, selling such a low implied volatility will not be a profitable game.

NASDAQ 100 stocks implied vs. realized volatility

As it seems that current VIX is too low to sell, let`s have a look at the implied vs. realized volatility of the NASDAQ100 stocks. The table below gives the implied volatility (Sep. 30th.2018) and the long term fair bet price for volatility. To calculate this comparison 10 years of data per stock has been analyzed.

The higher the ratio of fair bet kvol vs implied volatility, the better the chances are that volatility selling is profitable. TSLA, XRAY, COST and CTAS are some of the stocks you might have a look on, CA, SIRI, FOX are some of the stocks I would not think about when setting up the next short straddle.

Continue reading

Scanning for Support and Resistance Probabilities

I have been in search for a signal I could use for a short vertical spread or naked short option strategy. So my main concern has been to find a level, which will most probably not be penetrated over the next few bars.

This is what I came up with.

Support and Resistance

We are all familiar with oscillators like the RSI indicator. It gives an idea if the market is oversold or overbought.

The chart gives a basic idea of the signal I am looking for. Once the indicator is leaving the overbought / oversold area, there should be a good chance that the market actually stays above or below it’s previous high or low. If this probability is high enough, it would be a great signal for a short vertical spread or to sell a naked put / call option. (be aware of the unlimited risk in the naked short trade!) Both strategies win, if the selected level is not penetrated at expiry.

What is manually drawn on the chart above can also be done automatically. The following chart shows how it looks like if you use the code given at the end of the article.

Every time the RSI leaves the extreme zones the indicator will draw the previous high or low for a given prognosis interval. To enhance the chances and not to get too many signals in a trending market I also made use use of the ADX indicator. So to see a signal on the chart, RSI has to leave the extreme level while ADX signals a sideway market. This should give the best signal quality.

The three signals shown would have resulted in a winning trade as the market did not cross the shown support / Resistance levels. But how does it work out in the long term?

Continue reading

Statistics of VIX

The CBOE volatility index VIX  measures the market’s expectation of future volatility. It is the gauge of S&P500 equity market volatility.

The spikes to the top and the long phases of relatively low volatility are reflected in a left-leaning distribution diagram and a long tail towards the higher panic levels. The median value is 17%, meaning 50% of the prices are above (below) this level.

The next chart shows the distribution of returns over 25 trading days. The median price movement being slightly shifted to the negative area shows the mean reverting characteristics of volatility.

Analysing the level of VIX and the returns afterwards yields an even more interesting picture:

The green line gives the 25 bar percentage returns of VIX, with VIX noting above 25, the red line gives the returns with VIX below 15. Observe the median of the two lines:

The median 25 bar return with VIX above 25 (green) is around -15%, only 20% of the returns are positive. The return with vix below 15 (red) is above 0% and with a fat tail to positive returns. Data from 2004-2018

 

The above chart suggests that going short on volatility, if VIX is above 25, seems to be a good idea, the next chart shows what will most probably go wrong during the next 25 days. The distribution diagram gives the maximum adverse movement of the VIX.

The green line, VIX above 25, shows a +10% median maximum up movement over 25 days. So do not expect a short vola position to be without risk.

 

On the other side, the distribution of the maximum loss of the VIX during a 25 day period shows a median of below -20%.

 

Best to test for yourself,  returns distribution indicator for tradesignal code

 

Machine Learning – KNN using Tradesignal Equilla

I always thought that inspiration and experience is a key factor in trading. But everytime my chess computer beats me without any inspiration, just by brute force, I start to reconsider this assumption. This article will be about a brute force approach in trading.

Rule based trading

I have never been a great believer in classical technical analysis. If you ask 2 analysts about the current trend in the market, you get at least 3 answers. So I turned to algorithmic trading, using the tools of technical analysis in a new way, doing if..then conditions, backtesting them, refining the rules and parameters until the desired result was shown. These if..then based conditions, like if the market is above it`s 200 day line then go long, are mostly found by experience and inspiration. Isn’t my brain just a neural network which can be trained with historic data (experience), enhanced with a glass of wine for the inspiration?

Today I would like to take a voyage into machine learning. I would like to let my computer find the rules by itself, and just decide if I like the results or not. I’ll have the glass of wine with some friends and let the machine do the job; This sounds tempting to me, but can life really be as easy?

Unsupervised machine learning – kNN algorithm

The knn algorithm is one of the most simple machine learning algorithms. Learning might be the wrong label, in reality it is more of a classification algorithm. But first let’s see how it works.

The scatter chart above is a visualization of a two dimensional kNN data set. For this article I used a long term and a short term RSI. The dots represent the historic RSI values. Have a look at the fat circled point. It just means, that todays RSI1 has a value of 63, and RSI2 got a value of 70. Additionally the dots have got colours. A green dot means the market moved up on the following day, a red dot shows a falling market on the day after.

kNN – k nearest neighbours

To do a prediction of tomorrow’s market move, the kNN algorithm has a look at the historic data (shown on the scatter plot) and finds the k nearest neighbours of today’s RSI values. As you can see, our current fat point is surrounded by red dots. This means, that every time the 2 RSI values have been in this area, the market fell on the day after. That’s why today’s data point is classified as red. Call it classification or prediction, the kNN algorithm just has a look on what has happened in the past when the RSI indicators had a similar level. Have a look at this video, it is a great explanation on how the algorithm works.

kNN as Tradesignal Equilla Code

Computer kiddies would implement this algorithm in Python or R, but I would like to show you an implementation with the Tradesignal programming language Equilla. It is way faster than Python, and has got the advantage that I can directly see all the advantages and disadvantages on the chart. It is not just number crunching.

To implement the algorithm in Tradesignal we first have to do the shown scatter plot, but not graphically but store the 2 rsi values and the next days market move(colour of dots) into an array.

In line 8&9 the rsi values are calculated, line 12&13 calculates the next day`s market move. Line 15 to 20 then stores the data into the training data array. This is done for the first half of the data set, for my example I will use the data from bar 50 to 1000 on my chart of 2000 data points.

The next task to complete is to calculate the distances of today’s rsi point to all the historic points in the training data set.

Line 23 to 27 calculates the euclidean distance of today’s point to all historic points, line 29 then creates a sorted list of all these distances to find the k nearest historic data points in the training data set.

We are nearly done. The next step is just to find out what classification (colour) the nearest points have got and use this information to create a prediction for tomorrow. This is done in lines 33 to 35

Have a look at the scatter chart at the beginning. If this would be the data stored in our training data set, the prediction, using the 5 nearest neighbours, would be -5. All the 5 nearest neighbours of our current data point are red.

Now that we got a prediction for tomorrow, we just have to trade it:

kNN algorithm performance

Lets have a look if this simple machine learning algorithm works. Using 2000 days of backward adjusted brent data, I used a 14 and 28 day RSI to predict the next day move. The training was done on bar 50 to 1000, and I used the 5 nearest neighbours for the classification.

Knn algorithm – conclusion

Judging on the shown graph it seems to work. It seems to be possible to use these 2 RSI indicators to predict tomorrow’s brent move.

kNN algorithm gives me a framework to test all kind of indicators or even different data sets easily and see if they have got any predictive value.

This is definitely an addition to classical algorithmic trading, using if..then conditions build from experience and intuition.

But you might still need some intuition to find the right data sets, indicators and parameters to get a useful prediction. Not everything can be done by machine learning…

 

 

 

NASDAQ 100 long term candlestick scanner

A short update on the long term Candlestick Scanner.

The Candlestick Scanner scans the Nasdaq 100 stocks for long term bullish or bearish reversal patterns.

The basic idea is to search for hammer and hanging man candlestick patterns. Usually these patterns work nicely on daily charts. My Candlestick Scanner searches for these two patterns on every time frame, from a 1 day per bar compression up to a  250 days per bar compression. This enables me to use a simple, well defined and documented pattern as a description of short to long term reversal setups.

But see for yourself which Nasdaq stocks seem to change the direction according to the long term Candlestick Scan. The list gives you the duration of the reversal formation (expect about the same time to either reach the target or get stopped out) The detected pattern becomes a valid entry signal if a new high (hammer) or low (hanging man) is established.

Bullish reversals on the left side, bearish reversals on the right side.

 

Position sizing – the easy way to great performance

Working on your position sizing algorithm is an easy way to pimp an existing trading strategy. Today we have a look at an energy trading strategy and how the position sizing can influence the performance of the strategy.

The screenshot shows you the returns of the same trading strategy, trading the same markets, the same time frames and using the same parameters. The returns on the left side look nice, making money every year. The returns on the right side are somehow shaky, and you would have to love volatility of returns if you would think about trading this basket. The only difference between the basket on the right and on the left side is the position sizing.

The energy basket:

The basket trades German power, base and peak (yearly, quarterly, monthly), coal, gas, emissions. All instruments are traded on a daily and weekly time frame chart, using the same parameters. If the daily trading uses a 10-period parameter, the weekly trading would use a 10-week parameter. This limits the degrees of freedom I have when doing the strategy-time frame-parameter merge, thus minimizing the curve fitting trap.

Continue reading

EEX Phelix Base Yearly – Buy Wednesday, short Thursday?

When it comes to simple trading strategies, the day of the week is surely one of the best things to start with. That’s nothing new when it comes to equity markets. Everybody knows about the calendar effects, based on when the big funds get and invest their money. I do not know about any fundamental reason for the day-of-week effect in German power trading, but is seems to be a fruitful approach.

First of all I have to point out that it is not only the day of the week which is important. A strategy that just buys on Wednesdays and sells 1 or 2 days later would be doomed. But if you add a little filter which confirms the original idea, you will end up with a profitable trading strategy.

This filter will just be a confirmation of the expected move: If you suspect that Wednesday ignites a bullish movement, then wait until Thursday and only buy if the market exceeds Wednesdays high. Same for the short side, wait for a new low before you enter!

Have a look at the chart. The strategy shown buys on Thursdays if Wednesdays high is exceeded. The position is closed 2 days after the entry.

If you run a simple test which day of the week is the best to get ready for a long trade the day after then the next chart shows the return on account of the strategy using data from 2012 up to now: (exit one day after entry)

Continue reading

Opening Range Breakout

Ein Opening Range Breakout System von Perry Kaufmann.

Es wurde im Magazin “Technical Analysis of Stocks&Commodities” im Juli 1994 besprochen, und wie es scheint, funktioniert es noch immer.

Das System wartet die erste Handelsstunde ab und geht dann bei Ereichen eines neuen Hochs oder Tiefs  long oder short.  Die Einstiegs Order (Stop Buy / Stop Sell) wird nicht exakt auf das Hoch / Tief gelegt, sondern ein paar Punkte darüber /darunter. (hier 20 Ticks)

Prinzipiell ist die Strategie der Afternoon Trader Strategie sehr ähnlich.

TSM(S) 1st hour breakout detail

Da die hier vorgestellte Systemversion  ursprünglich für dieTradestation 2000i in Easy Language geschrieben wurde, ist das Laden von 3 Zeitreihen ein wenig kompliziert gelöst. Aber es funktioniert.

Backtest mit adjustiertem DAX Future:

TSM(S) 1st hour breakout backtest

zum Tradesignal Equilla Code Passwort “code”