Registered User Joined: 10/7/2004 Posts: 1,178
|
An example today of a very profitable short trade is HA. HA gapped down very small and continued down even below 3 Std Dev on my Exponential 26-Period Bollinger Band.
I'm interested to see if the new V17 capabiliites include a module for the Bollinger Band Squeeze or Pinch.
For HA, this Squeeze or Pinch occurred three to four days ago.
With new capabilities (or without), please code this with my 26-period Expoential Bollinger Band and two Std Dev.
Thanks, Bruce.
BTW, I really appreciate the x bars ago now available capability for Easy Scans.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You really have to define what you mean by a squeeze. One definition I've seen for Bollinger Bands is the width being less than 6% of the value of the centerline.
CountTrue(4 * STDDEV26 < .06 * AVGC26, 4) > 0
Another would be the width of the Bollinger Bands being less than the width of Keltner Channels of the same period.
CountTrue(4 * STDDEV26 < 3 * ATR26, 4) > 0
Or the width of the Bollinger Bands being at a new low over some arbitrary number of bars (in this case 52 bars).
CountTrue(STDDEV26 < MIN(STDDEV26.1, 52), 4) > 0
The three formulas above should produce different but similar results. I am sure there are many other possible definitions as well.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
I look forward to testing each of them. Thanks, Bruce.
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
Just a question...
Are each of these for Exponential 26-Period Bollinger Bands?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The only one of the techniques for which it would make a difference is the first one, as it relies on the value of the centerline (the other two only use the width). It could be modified by adding an X to the formula.
CountTrue(4 * STDDEV26 < .06 * XAVGC26, 4) > 0
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
I've placed each formula into a a Custom PCF % True and added each Plot to my Chart for comparison and contrast.
From doing this, I can see the most accurate result appears to be the second formula below:
As you said, Another would be the width of the Bollinger Bands being less than the width of Keltner Channels of the same period.
CountTrue(4 * STDDEV26 < 3 * ATR26, 4) > 0
One caution to other TC Users: at first, it appears the PCF isn't accurate in an Easy Scan. That is because it takes time for the computer to do all the calculations which are of Medium Speed, not Fast.
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
When CountTrue(4 * STDDEV26 < 3 * ATR26, 4) > 0 is plotted as a Custom PCF % True on the chart, then edited as Plot Style Histogram, one can count how many days the Squeeze or Pinch has occurred.
Two example in which the Squeeze or Pinch occurred just today are DVAX and FET (thus just one HIstogram).
Rather than counting the number of Histograms on the Chart for each Symbol that the Easy Scan delivers, it would be helpful to have a formula for NOT TRUE.
In other words, the Exponential 26-Period Bollinger Band with 2 Standard Deviations is OUTSIDE the Keltner Channels.
So, then one can use the NOT TRUE Condition as 1 Bar Ago with the TRUE Condition as Now.
This would sort out any new Symbols in which the Squeeze or Pinch has occurred today.
I tried doing this by changing the > to < but this doesn't work.
Help needed.
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
But now I'm thinking that maybe I didn't wait long enough for the calculation of NOT TRUE with the < to complete.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you are just interested in the first bar and not going out 4 bars.
4 * STDDEV26 < 3 * ATR26 AND NOT(4 * STDDEV26.1 < 3 * ATR26.1)
Or:
4 * STDDEV26 < 3 * ATR26 AND 4 * STDDEV26.1 >= 3 * ATR26.1
Or:
XUP(ABS(4 * STDDEV26 < 3 * ATR26), .5)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
I've tested the first one and have named it xBB26 2.0 Outside KelChan. It works as a stand alone finding Bollinger Bands that were outside the Keltner Channel yesterday, but within the Keltner Channel today.
I see that each of these returns the same results, which is great.
However, let's take DVAX as an example. Bollinger Bands were inside the Keltner Channel from 5/5/17 to 6/7/17.
Ideally, a swing trader would enter on 6/8/17 above $7.10. The swing could last until the Near-Doji on 6/26/17 or the day after on 6/27/17 at about $10.00.
The result would be a very nice return of $2.90 per share or 40%.\
TO FIND THIS TRADE ONE MIGHT WANT TO SCAN LIKE THIS:
First, scan for Bollinger Bands inside Keltner Channels for X BARS IN A ROW.
Then, scan for Bollinger Bands outside Keltner Channels NOW.
Thus, the Swing Trader would need a more flexible PCF for Bollinger Bands outside Keltner Channels Now (as opposed to the prevous three you've given above).
Can you please provide this?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Maybe something like the following (where X = 5 and can be changed as desired).
4 * STDDEV26 > 3 * ATR26 AND TrueInRow(4 * STDDEV26.1 <= 3 * ATR26.1), 5) = 5
Note that the formula doesn't actually check if the Bollinger Bands are inside the Keltner Channels or not, it checks if the Bollinger Bands are narrower than the Keltner Channels or not. This can be different because the centerline of the Bollinger Bands and Keltner Channels are different in TC2000.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
I see Keltner Channel defaults are 20 Period and 1.50 ATR Multiplier.
Are you using defaults?
Or, have you adjusted the Keltner Channel values because I am not using default Bollinger Band values -- and not Simple Bollinger Band defaults, but Exponential Bollinger Bands 26 Period and 2.0 Standard Deviations?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I have adjusted the period of the Keltner Channels to 26 to match the Bollinger Bands.
The number after STDDEV is the period of the Bollinger Bands.
The number after ATR is the period of the Keltner Channels.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
Just to confirm, I understand that Keltner Channel period is 26.
It doesn't make sense to me that the ATR would also be 26.
Is the ATR the default of 1.50 or have you changed it to 2.0?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You can change the periods to whatever you want. I used the same period because that is how it is done with a TTM Squeeze (which is what this formula represents). It is also why the ATR being used is using a simple moving average (because that it how TTM does it and because it more closely matches up with the standard deviation calculations).
As to why the ATR period would match the Keltner Channel period, it is because Keltner Channels are calculated using ATR.
Keltner Channels are a centerline plus a multiple of Average True Range for the upper channel and minus a multiple of ATR for the lower channel. The default multiple is 1.5 and was not changed.
Multiplying 1.5 by 2 to get 3 gives you the multiple for the distance between the top and bottom channel (which is why the formula uses 3 * ATR).
The center line of Keltner Channel is a moving average of (H + L + C) / 3 of the same period as the ATR (but we aren't using the centerline in the calculatios).
Keltner Channels
If you wanted to check for 26 period exponential Bollinger Bands being inside 20 period exponential Keltner Channels, the formula would be longer. It would also depend on if you wanted both bands inside the channels.
XAVG((H + L + C) / 3 - 1.5 * ATR1, 20) <= XAVGC26 - 2 * STDDEV26 AND XAVGC26 + 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR1, 20)
Or just at least one of the bands inside the channels.
(XAVG((H + L + C) / 3 - 1.5 * ATR1, 20) <= XAVGC26 - 2 * STDDEV26 AND XAVGC26 - 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR1, 20)) OR (XAVG((H + L + C) / 3 - 1.5 * ATR1, 20) <= XAVGC26 + 2 * STDDEV26 AND XAVGC26 + 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR1, 20))
Bollinger Bands
Note that these formulas aren't checking for anything complicated like being inside the channels for x bars in a row and now be outside or anything. These formulas are just checking for the Bollinger Bands being inside the Keltner Channels.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
I apologize for still being unsure...
The PCF I am using is CountTrue(4 * STDDEV26 < 3 * ATR26, 4) < 0
I guess STDDEV26 refers to BB26 with 2 Std Dev
and
3 * ATR26,4 refers to Keltner Channel 26 with a distance of 3 * ATR as the distance from top and bottom channel
WHICH MEANS THAT A CANDLE'S HIGH AND LOW WOULD BE INSIDE OR WITHIN THE KELTNER CHANNEL
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Well yes, a candle's high and low could be inside the Keltner Channel if price is near the centerline of the Keltner Channel. That actually happens a lot. But it doesn't mean a candle's high and low will always be inside the Keltner Channels because price can deviate quite a bit from the value of the centerline.
4 * STDDEV26 is the width of 26 period Bollinger Bands with a width of 2.00 (2 standard deviations). This is true no matter what type of Bollinger Bands (simple, exponential, front weighted or Hull).
3 * ATR26 is the width of 26 period simple Keltner Channels with a width of 1.50 (1.5 times average true range). This is used for the reasons already given above (and makes sense if the idea is to determine if the Bollinger Bands are "narrow" or not as opposed to comparing them to specific Keltner Channels plotted on the chart).
If you wanted the width of 26 period exponential Keltner Channels with a width of 1.50, then the fomula would be:
3 * XAVG(ATR, 26)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
Thanks for that full explanation of how a candle's High and Low can sometimes be outside the Keltner Channel despite a PCF that seeks to find Bollinger Bands within the Keltner Channel.
Here's the PCF I prefer: CountTrue(4 * STDDEV26 < 3 * ATR26, 4) < 0
To match the above PCF, on my chart I am using an Exp 26-Period BB with 2 Std Dev along with a Simple 26-Period Keltner Channel with 1.5 ATR.
Let's convert that Simple 26-Period Keltner Channel with 1.5 ATR to an Exponential Channel as you;ve suggested above. It seems I simply change the 26-Period Keltner Channel with 1.5 ATR from Simple to Exponential, so we have the PCF below.
BB26 2.0 Btm & Top Inside KelChan 26 1.5 ATR 170726 Bruce
XAVG((H + L + C) / 3 - 1.5 * ATR1, 20) <= XAVGC26 - 2 * STDDEV26 AND XAVGC26 + 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR1, 20)
And, if we want
BB26 2.0 Btm OR Top Inside KelChan26 1.5 ATR 170726 Bruce
(XAVG((H + L + C) / 3 - 1.5 * ATR1, 20) <= XAVGC26 - 2 * STDDEV26 AND XAVGC26 - 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR1, 20)) OR (XAVG((H + L + C) / 3 - 1.5 * ATR1, 20) <= XAVGC26 + 2 * STDDEV26 AND XAVGC26 + 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR1, 20))
Note that the first computes at a medium speed whereas the second computes at a slow speed.
Despite knowing this, when I just tested each PCF with four criteria in an Easy Scan of 5072 stocks and ETFs, the result was fast (but it is now 1:23 pm EST).
I imagine tests during market hours will be slower.
|
|
Registered User Joined: 9/17/2010 Posts: 484
|
So I have set this up, but with a couple of differences:
-
Because I might miss the day the Squeeze Fired, I want a view back a few days (I arbitrarily select 4)
-
I'm using the TTM Squeeze parameters as Bruce has developed and made available
My Scan is set up with Condition
-
Squeeze is On 4 Days Ago STDDEV20 * 4 <= 3 * ATR20
Columns
-
CountTrue(STDDEV20 * 4 <= 3 * ATR20,20) gives me # Days squeeze on in the past 20. Since Squeeze may have fired, I use CountTrue rather than TrueInRow
-
Two columns for Squeeze has fired [XUp(STDDEV20 * 4,3 * ATR20)], one for today,and one within the last 4 bars
-
They should be those I am interested in trading today
Where Squeeze has NOT Fired
-
I would want to assess the population for those with the most potential (eg EPS Growth, or movement over past 6 months, what ever).They have no check marks in either Squeeze Fired column
-
Which ones are close to Firing? If I have done this correctly, its those with the smallest Squeeze Gap, defined as [100*(4 * STDDEV20 - 3 * ATR20)/4 * STDDEV20]. If Squeeze Gap is positive, then the Squeeze has fired, so I'm interested in those with negative Squeeze Gap.
-
Theoretically, the Smaller Squeeze Gap stocks are closest to firing,but we know the trends don't play out "correctly" all the time, so they are the most likely suspects.
-
I plot Squeeze Gap as a Histogram, so I can see its movement.
-
Hopefully I can then focus on those with the most potential for a profitable squeeze firing
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Those formulas have 26 period Bollinger Bands and 20 period Keltner Channels as mentioned in the post (because you seemed concerned about both the Keltner Channel period and average type).
If you are going to have exponential Bollinger Bands 26, 2.00 and exponential Keltner Channels 26, 1.50, then (in order of complexity of calculation):
Bollinger Bands narrower than Keltner Channels:
4 * STDDEV26 < 3 * XAVG(ATR, 26)
Both Bollinger Bands inside Keltner Channels:
XAVG((H + L + C) / 3 - 1.5 * ATR, 26) <= XAVGC26 - 2 * STDDEV26 AND XAVGC26 + 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR, 26)
At least one Bollinger Band inside the Keltner Channels:
(XAVG((H + L + C) / 3 - 1.5 * ATR, 26) <= XAVGC26 - 2 * STDDEV26 AND XAVGC26 - 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR, 26)) OR (XAVG((H + L + C) / 3 - 1.5 * ATR, 26) <= XAVGC26 + 2 * STDDEV26 AND XAVGC26 + 2 * STDDEV26 <= XAVG((H + L + C) / 3 + 1.5 * ATR, 26))
You can CountTrue() or TrueInRow() these formulas as desired.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2017 Posts: 1,227
|
Bruce,
I'm still just on my second cup of coffee, but given this discussion, and the new PCf syntax available in v17 ... how does this impact your world-famous TTM Squeeze indicator? Is there an easier/better/more efficient way to code it?
Your TTM Squeeze indicator, iff I recall, looked for BBs narrower than KCs, with a BB SMA centerline, and a KC EMA centerline. I could be wrong, it's Friday :)
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It has been explored in other topics, but TTM Squeeze On as a condition formula (not as an indicator) is just the following using the v17 syntax.
STDDEV20 * 4 <= 3 * ATR20
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2017 Posts: 1,227
|
Thanks Bruce, still getting the hang of v17 condition formulas. I'm stuck in the old-school world of plotting the indicator first and adding a column later if I want to see it there as well.
Condition formulas are really cool for criteria you're interested in knowing, but not necessarily seeing plotted on a chart.
Now, if we could just paint the price bars, and add a procedural language with loops and variables. Maybe by Monday? LOL.
|
|
Guest-1 |