coding a volatility squeeze
Author: chrshale
Creation Date: 2/11/2011 1:09 PM
profile picture

chrshale

#1
Can anyone help me write the code for a screener that will alert when a closing stock price is greater than 6% of the difference between the upper and lower bollinger bands? I have written:

CODE:
Please log in to see this code.


But the compiler says I can't use the "-" on operands of type 'method group'. I'm not a programmer, so I don't know how to fix this. Help!
profile picture

Cone

#2
Greater than 6% of the difference, added to what?
profile picture

Eugene

#3
The "difference between the upper and lower bollinger bands" is in fact Simple Moving Average. It's in the middle of the upper and lower bands, by design.

By mentioning the "volatility squeeze", I guess, buying when the price gets 6% above the SMA isn't what you're after. Please clarify your rule.
profile picture

chrshale

#4
I'm looking for situations where the absolute difference between the upper bollinger band at close minus the lower bollinger band at close is less than 6% of the closing stock price. The implication is that diminution of volatility may ultimately be reversed with a rapid move to the up or downside. Stocks that cross to the upside of tight bollinger bands frequently maintain momentum for some time. For instance, daily charts of CMG and PCX both show periods of bollinger bands tightening prior to moves to the upside.
profile picture

chrshale

#5
in other words, if the distance between the upper and lower bollinger bands at close is 5 points and the stock price closes at 100, I want the alert.
profile picture

Eugene

#6
In other words, the % Band Width is 6% or less. We have coded this before in many variations:

ActiveTrader 2008-03 | Bollinger Band intraday breakout anticipation
Futures & Options Trader 2008-01 | Bollinger Band breakout-anticipation system
Squeeze indicator

CODE:
Please log in to see this code.
profile picture

chrshale

#7
I'll study these examples and see if I can get mine to work.

thanks