Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 1/6/2007 Posts: 65
|
Hi, I would like to know if there is anyway to create a plot that displays what percentage the current price is within the 20MA/20SD bollinger bands in Stockfinder.For instance if price was within 2.3% of the bottom bollinger band the plot would read 2.3. If it was 6% within the top bollinger band it would read the number 6. Anything outside the bollinger bands in either direction can be considered overbought/oversold and return the value of 0, indicating no percentage within the bollinger band. The midline should be considered the 50% mark. Thank you guys so much. It is always a pleasure to be able to use your expertise.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Percent within Bollinger Bands
'|******************************************************************
'# Bb = indicator.Library.Bollinger b
Dim FromCent As Single = System.Math.Abs(Bb.Value - 50)
FromCent = System.Math.Min(FromCent, 50)
Plot = 50 - FromCent
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/6/2007 Posts: 65
|
Thank you so much! I was also wondering if there was a way to rank the worden industry list by %gain over x periods.Thanks!
|
|
Registered User Joined: 1/6/2007 Posts: 65
|
I entered the code into stockfinder and realized that when price is "overbought" it says 50... Is there anyway to make the midpoint between the bollinger bands 50 and then extremes 0? This would allow my to be able to tell what percentage away price is from the extremes.
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
That's the way it works as Bruce coded it. Values approach 50 when price is nearthe centerline and the approach 0 as price nears the upper or lower band. Value is 0 when price is outside the upper or lower band.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (michaelfili) I was also wondering if there was a way to rank the worden industry list by %gain over x periods.
Add a Price Rate of Change (Percent) Indicator to the Chart, Adjust the Period as desired, Drag and Drop it to the WatchList and select Sort. If will then Sort whatever Active WatchList is selected by the Percent Change (including any of the Industry WatchLists).
Working with Indicators
Sortable Columns from Indicators
QUOTE (michaelfili) I entered the code into stockfinder and realized that when price is "overbought" it says 50...
No. The Indicator returns 0 when Price is above the Upper Bollinger Band.
QUOTE (michaelfili) Is there anyway to make the midpoint between the bollinger bands 50 and then extremes 0?
It already does so.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/6/2007 Posts: 65
|
In its current form, it is hard for me to tell what percentage away from the extremes price is resting. For example, if it is above or below the top/bottom band i would like a reading of 0, and if it is anywhere inside of the bands I would like it to read from 50 outwards. 50 of course being the midpoint of the bollinger bands (20SMA).
|
|
Registered User Joined: 1/6/2007 Posts: 65
|
When I put it into stockfinder, it has the upper value of the indicator as 50, and the bottom value as 0...
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
That is exactly what it already does.
It reads 0 when it is outside the Bollinger Bands.
It reads 50 when it is exactly in the center of the Bollinger Bands.
The Value of the Indicator increases as it gets closer to the center of the Bollinger Bands.
If you want the bottom to be 50 and the top to be 0 instead of the bottom being 0 ath the top being 50, you can right-click on the Value Scale and select Invert Scale.
QUOTE (michaelfili) ...50 of course being the midpoint of the bollinger bands (20SMA).
Based on this, one thought is that you have changed your mind about what you want. If you want the Value to run from 50 to 100 (with 100 being the very edge of the Bands), then you could do something like the following:
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Unnamed Bollinger Percent Indicator
'|******************************************************************
'# Bb = indicator.Library.Bollinger b
Dim FromCent As Single = System.Math.Abs(Bb.Value - 50)
If FromCent > 50 Then
FromCent = -50
End If
Plot = 50 + FromCent
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/6/2007 Posts: 65
|
Thank you for the rank condition btw...
|
|
Registered User Joined: 1/6/2007 Posts: 65
|
Yes, you are correct. I wasn't reading it correctly. Is there anyway to make it oscillate around 50 and have the extremes be 0? That would be amazing.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You want the Scale to run from 0 to 50 and then back to 0 with the line being above 50 when Price is above the centerline and below 50 when Price is below the centerline? If so, I cannot think of a way to do so.
We can just limit Bollinger %b to running from 0 to 100 however. The centerline will be 50 and the lower section will match the desired Values. When Price is above the centerline however, the Value will get larger instead of smaller:
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Restricted Bollinger b
'|******************************************************************
'# Bb = indicator.Library.Bollinger b
Dim FromCent As Single = System.Math.Max(Bb.Value, 0)
Plot = System.Math.Min(FromCent, 100)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/6/2007 Posts: 65
|
Awesome, you're the best. One last question... How can I make a plot that spits out the percentage that price is from its rolling 52-week high (or 250 period on a daily chart)?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could try the following RealCode Indicator:
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Percent from High
'|******************************************************************
'# Period = UserInput.Integer = 250
If CurrentIndex > Period Then
Plot = 100 * (Price.Last / Price.MaxHigh(Period) - 1)
Else
Plot = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |