Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

% X above/below upper/lower BB Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
burls
Posted : Tuesday, January 29, 2013 5:19:27 PM
Registered User
Joined: 10/5/2009
Posts: 66

Hi,

I tried seaching for a SF 5.0 formula (I can adjust for below or above the B) that would provide the following-but was unable to find one-can you help me out?

BB 20, StdDev 2.00

Todays price low (high) was "X" % or more below (above)  the lower (upper) BB

Closed in bottom "X" % of the day's range

Thanks, Burls

Bruce_L
Posted : Wednesday, January 30, 2013 10:01:23 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You can use a 1-Period Stochastic to check for where the close is relative to the range of the bar as a percentage. 0 would be all the way at the bottom and 100 would be all the way at the top. So checking for the value of a 1-Period Stochastic being at or below X would check for the close being in the bottom X% of the day's range.

Bollinger b (or %B) is the indicator which is normally used to determine where price is relative to the range of the Bollinger Bands. It is 0 when at the bottom of the bands and 100 when at the top of the bands. So if Bollinger b is 110, then it is 10% of the width of the Bollinger Bands above the Top Bollinger Band and if Bollinger b is -20, then it is 20% of the width of the Bollinger Bands below the Bottom Bollinger Band.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
burls
Posted : Wednesday, January 30, 2013 4:42:01 PM
Registered User
Joined: 10/5/2009
Posts: 66

I'm not sure this will give me what I'm looking for..."So if Bollinger b is 110, then it is 10% of the width of the Bollinger Bands above the Top Bollinger Band"

As an example the SPY on Nov 8/12 closed at $138.04.....Lower band = $138.67......and %b = -8.22...but the SPY was not 8.22% below the lower band...

I would not want to get the SPY on my list until it was 10% below $138.67

 Perhaps I'm missing something?

Thanks, Burls

Bruce_L
Posted : Wednesday, January 30, 2013 4:58:33 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The first two lines of the following RealCode Condition were created by dragging and dropping the Bollinger Bands of interest into the Code tab of the RealCode Editor for a RealCode Condition. You will need to do so as well to use your Bollinger Bands. You can't just copy and paste the RealCode unless you already have teh Bollinger Bands on the chart and they have the exact same name as my Bollinger Bands).

'# BBTop = chart.BollingerBands.0
'# BBBottom = chart.BollingerBands.1
'# Percent = UserInput.Integer = 10
If Price.Last >= (1 + Percent / 100) * BBTop.Value OrElse _
	Price.Last <= (1 - Percent / 100) * BBBottom.Value Then Pass


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
burls
Posted : Wednesday, January 30, 2013 5:18:32 PM
Registered User
Joined: 10/5/2009
Posts: 66

I'm not sure this will give me what I'm looking for..."So if Bollinger b is 110, then it is 10% of the width of the Bollinger Bands above the Top Bollinger Band"

As an example the SPY on Nov 8/12 closed at $138.04.....Lower band = $138.67......and %b = -8.22...but the SPY was not 8.22% below the lower band...

I would not want to get the SPY on my list until it was 10% below $138.67

 Perhaps I'm missing something?

Thanks, Burls

burls
Posted : Wednesday, January 30, 2013 5:24:28 PM
Registered User
Joined: 10/5/2009
Posts: 66

Sorry re-posted the my 1st reply...(Thanks for the formula on that one) but was looking to add this question..

I set the stoch. to 1 period....as an example-I checked AMZN on Oct. 25/12...the low of the day was $222.92 and it closed at $222.92...but stoch. was at 24.34.....

I selected from the Indicator choices   "Stochastics"...and changed the default setting of 12 period to 1

I must be missing something...

Thanks again, Burls

burls
Posted : Wednesday, January 30, 2013 5:47:52 PM
Registered User
Joined: 10/5/2009
Posts: 66

 Hi Bruce,

When I pasted the formula you supplied-no problem-those at greater than 10% were identified....but when I put in # Percent = UserInput.Integer = 2....nothing was identified....

 

'# BBTop = chart.BollingerBands.0
'# BBBottom = chart.BollingerBands.1
'# Percent = UserInput.Integer = 2
If Price.Last >= (1 + Percent / 100) * BBTop.Value OrElse _
Price.Last <= (1 - Percent / 100) * BBBottom.Value Then Pass
 
Thanks, Burls......
Bruce_L
Posted : Thursday, January 31, 2013 8:42:00 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

It is probably still using 10 as the value for Percent.

The UserInput line in the RealCode creates a User Input which can be used to adjust the setting, but changing the assigned value in the UserInput line after it has been created and compiled will not change the actual value of the Percent variable.

You need to Edit the condition and change the Percent setting in the User Input that was created by the RealCode.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
burls
Posted : Thursday, January 31, 2013 4:12:41 PM
Registered User
Joined: 10/5/2009
Posts: 66

Hi Bruce,

Two things I'm not sure about.....

-You said I need to Edit the condition and Change the Percent setting...so problem changing the Percent setting but not sure what to Edit in the indicator as the BB indicator is set to what I want....

-Second part is I set the stoch. to 1 period....as an example-I checked AMZN on Oct. 25/12...the low of the day was $222.92 and it closed at $222.92...but stoch. was at 24.34.....

I selected from the Indicator choices   "Stochastics"...and changed the default setting of 12 period to 1

I must be missing something...

Thanks again, Burls

 

Bruce_L
Posted : Thursday, January 31, 2013 4:49:09 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

If the Bollinger Band is set up how you want, there shouldn't be anything to change in the Condition besides the Percent setting. You would adjust the Bollinger Band indicator to adjust the Bollinger Band settings used by the Condition.

You could theoretically delete the Bollinger Band indicator from the chart and then those settings would be bottled into the Condition. There would then be a tab available when editing the Condition to adjust the Bollinger Band settings being used for the calculations.

The value of a 1-Period Stochastic for AMZN on October 25, 2012 is 0, not 24.34. It reads like you might not have changed both the Period and %K settings in the Stochastic to 1. The %K is a moving average of the raw Stochastic and the %D is a moving average of the %K. If the %K is set to 3 for example, it will be taking a 3-Period moving average of the Stochastic instead of displaying the Stochastic itself.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
burls
Posted : Thursday, January 31, 2013 5:41:27 PM
Registered User
Joined: 10/5/2009
Posts: 66

I'm not sure I understand.....Perhaps I missed something so I'll walk thru what I did

1. I opened up New RealCode Condition....

2. Saved the code which you had sent (which had Percent = UserInput.Integer = 10)  and used the "Show True Markers" no problem...conditions that were true were marked

3. I then Changed the Percent = UserInput.Integer from 10 to 2....applied and nothing was marked via the true markers

4. I let you know it didn't work and you said  "You need to Edit the condition and change the Percent setting in the User Input that was created by the RealCode."

5. I then mentioned that the indicator was set correctly.

6. You then said "If the Bollinger Band is set up how you want, there shouldn't be anything to change in the Condition besides the Percent setting".....But in #3 above I had only changed the Percent setting...but nothing was marked...

So not sure what to do as the indicator is set correctly....and only want to change the user input integer from 10 to 2....

Appreciate your patience,

Burls

Bruce_L
Posted : Friday, February 1, 2013 8:20:18 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Let's start by changing the RealCode Condition somewhat so we can use more precise percentages than integer values (if whole number values work for you, then you can leave it as is):

'# BBTop = chart.BollingerBands.0
'# BBBottom = chart.BollingerBands.1
'# Percent = UserInput.Single = 10
If Price.Last >= (1 + Percent / 100) * BBTop.Value OrElse _
Price.Last <= (1 - Percent / 100) * BBBottom.Value Then Pass

I suspect the issue is that you are just looking at symbols where price is not closing outside the bollinger bands by at least 2%, but let's go through changing the percent setting step-by-step.

Left-click on the Condition (or right-click and select Edit) to edit the Condition. There should be Percent, Passing and of the Last settings. Leave the Passing and of the Last settings alone and adjust the Percent setting to 2.0000.

Now we need to find a symbol where the close is at least 2% of the Top Bollinger Band above the Top Bollinger Band or 2% of the Bottom Bollinger Band below the Bottom Bollinger Band.

Assuming your Bollinger Bands are as described in your original post (Period 20, Std Dev 2.00), then there are quite a few symbols where this would currently be true on a Daily chart. If we look at just Optionable Items for example, we get BRCM, UEPS, SWKS, CLSN, DEPO, BGCP, CACI, CADX, ATHX, TIVO, HFC, RTN, FIO, CXS, TAOM, KEX, CRME, LQDT, GD, RSH, MJN, CBD, CLB, RDEN, OSIR, SNSS, ALGN, ORCC, KEM, SEIC, IIIN, AN, SMFG, AVB, PFMT, RTIX, HHS, MANT, CPRT, ALIM, KTOS, IVC, WHR, STZ, HNP, GNK, PBI, NAVB, RNDY, CBT, SGI, WMS, CNQR, HAR, TWC, KIRK, TSCO, ERIC, TWER, FTNT, MGAM, EVR, VELT, ENDP, INAP, AVG, GIB, CPNO, FSL, HA, ACO, PBR, CODE, RMTI, CEVA, ENVI, MERU, ANX, UIS, NTGR, OXF, VMW, WMAR, IBCP, KERX, SWIR, CMCO and ZN. That said, there are a lot of symbols where you need to zoom out quite far to see any markers on the chart.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.