Hello,
Does anyone know where I can get an AFL that gives me the formula for BBSqueeze but would also allow me to scan a list of Canadian stocks? I use EOD data for my trading. Thank you.
Tim
I'm sure I had one at one time....I'll have a look this morning
I seem to recall that i saw one on the Amibroker library one time...
Hi tim, I thought I'd check out this forum. I looked at the User AFL Library BB Squeeze code but it seems based on something very different. He is comparing BBands to Keltner Bands and when the BB are within the KB he defines the squeeze. It's an interesting idea but not what John Bollinger describes.
So I've taken a stab at the code with an exploration and a plot, and I rank the squeeze of you can choose whatever value you want to define "squeeze".
Attached is a screen shot of my version vs the User AFL Library version and they seem at times to be saying very different things. I have no idea which is "better", but mine seems to follow Bollinger's definition.
Good luck.
Larry
// BB Squeeze code
P = ParamField( "Price field", -1 );
Periods = Param( "Periods", 20, 2, 200, 1 ); // lookback period for calculating BB
Width = Param( "Width", 2, 0, 10, 0.05 ); // number of standard deviations for plotting the BB
RankLB = Param( "RankLB", 125, 10, 300, 5 ); // lookback period for squeeze definition
Bandwidth = ( BBandTop( P, Periods, Width ) - BBandBot( P, Periods, Width ) ) / MA( P, Periods ); // Width between top and bottom bands
BWrank = PercentRank( Bandwidth, RankLB ); // a way to rank the current width compared to itself over time
// you can set whatever number you are looking for in terms of
// how tight you want the squeeze, here I put in "10" meaning
// it ranks in the tightest 10 percent of band width over the past "RankLB" days
Condition1 = IIf( BWrank < 10, 1, 0 );
// for exploration here are a few columns to look for
Filter = 1; // all bars
AddColumn( BWrank, "BW Rank", 1.2 );
AddColumn( Condition1, "Condition1", 1.1 );
// Plot(Bandwidth, "Bandwidth", colorGold,styleThick);
Plot( BWrank, "Bandwidth Rank", colorRed, styleOwnScale );
There's a "BB Squeeze" code in the Amibroker library.
Tim, a search for "BB Squeeze" in the library will locate it or a search for the author "Vladimir Gaitanoff". The library is in the members zone now so I'm not sure if we're able to copy the code elsewhere otherwise I'd post it here.
Hmmm no, i have one coded by Radge, but we're not supposed to share the codes. I seem to recall that i saw one on the Amibroker library one time...
http://acmeanalytics.com/eol/?method=1Can someone explain to me how a squeeze works
BBs are generally at 20 period M/A
And a displaced 20 Period M/A
So it's lagging
I presume your looking for charts where these 2 M/As are close together and flattish
So if correct then what
If not
PS handy hint while writing code for indicators , I build most of mine to measure as % of price not points/dollars , much more universal and better for comparison between instruments with distinctly different price levels .. Also useful for pattern comparison multi years apart where price has changed dramatically ... Rock onThere are much easier ways to measure range compression . Donchian channel width one of the easiest . cant get more basic code ... high over 'x' period minus low over 'x' period , Much easier to code exactly what you want than try and bend some generic into a poor example of what you actually require . Writing custom code will set you free from the constraints of generics .
Hello and welcome to Aussie Stock Forums!
To gain full access you must register. Registration is free and takes only a few seconds to complete.
Already a member? Log in here.