I am looking at the recent formula placed into the AFL Library by Larry P - "BBsqueeze"
Firstly, I think the formula is good, I have been trying to develop something like this for a while and there are some good idea's that I just didnt think of.
My issue is around the PercentRank();
For the life of me I can not work out how it is getting the % and therefore by ranked in the lowest percentile (10th in this case)
I have read Amibroker help details, and still cant work it out.
To simplify my analysis, I have reverted to 10 days in the past, and the following are the bandwidths and %Rank
Is it a mathematical formula to get the %rank? How is %rank calculated?
Any help is greatly appreciated.
Thanks Larry for the code!
Days in the Past | Bandwidth | Percent Rank (using 10 as the lookback period) |
0 | 12.66 | 4.8 |
1 | 14.06 | 19.2 |
2 | 14.64 | 26.4 |
3 | 14.53 | 24.8 |
4 | 14.59 | 25.6 |
5 | 14.37 | 24 |
6 | 14.29 | 24 |
7 | 13.88 | 17.6 |
8 | 13.91 | 18.4 |
9 | 13.93 | 20 |
10 | 13.61 | 17.6 |
11 | 14.5 | 25.6 |
12 | 16.51 | 50.4 |
13 | 16.01 | 46.4 |
14 | 15.68 | 40.8 |
15 | 15.76 | 41.6 |
16 | 31.49 | 84.8 |
17 | 40.21 | 88 |
18 | 46.12 | 91.2 |
19 | 51.37 | 93.6 |
20 | 55.48 | 95.2 |
regards Adam
For reference: the formula by Larry P:
// 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 );
Posted by: madwill26@yahoo.com.au
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon