Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 1/26/2005 Posts: 6
|
Note;
I've just obtained StockFinder 5, and I would like to install the following "Real Code Condition";
Bollinger Band Width less than 3.0 times the lowest bandwidth in 125 days. The points needs to be marked on the stock plot and also an alert should be given when a low point is found. I would also like to make an occasional input change to alter the number 3.0, if this can be done easily. My code for this is:
If Price.Low<3.0 * Price.minlow(125) then
pass
Lokistatic.PlaySound("c:/alert.wav")
End If
Can you provide a correction to this code so that it will work?
Another question is, when I've made a bad "Real Code Condition" on a layout, how can it be deleted?
Charles Reeves
reevescn@hotmail.com
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You will need to replace the c:\alert.wav section with the path to any valid wave file on your computer.
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:BBwidth Ratio to Low below
'|******************************************************************
'# RatioToLow = UserInput.Single = 3
'# Period = UserInput.Integer = 125
'# BB = indicator.Library.Bollinger Bandwidth
If CurrentIndex >= Period Then
If BB.Value < RatioToLow * BB.MinLow(Period) Then
Pass
If isLastBar Then
LokiStatic.PlaySound("c:\alert.wav")
End If
End If
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/13/2004 Posts: 121
|
Could I impose and ask for realcode for the following condition?:
"Bollinger bandwidth within 25% of lowest bandwidth in 6 months and a close inside the bands," with the bands' periods and stdev parameters configurable, but defaulting to 20,2?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I started by creating a RealCode Indicator that I called "Combined Bollinger Band Indicator". The first two lines were created by Dragging and Dropping the Bollinger Bands from the Chart into the Code tab of the RealCode Editor.
'# BBTop = chart.BollingerBands.0
'# BBBottom = chart.BollingerBands.1
If BBTop.Value > BBBottom.Value Then
OpenValue = 100 * (Price.Last - BBBottom.Value) / _
(BBTop.Value - BBBottom.Value)
HighValue = BBTop.Value
LowValue = BBBottom.Value
Plot = 100 * (BBTop.Value - BBBottom.Value) / _
((BBTop.Value + BBBottom.Value) / 2)
Else
OpenValue = Single.NaN
HighValue = Single.NaN
LowValue = Single.NaN
Plot = Single.NaN
End If
Then I Dragged and Dropped that Indicator into the Code tab of the RealCode Editor to create the first line of the following RealCode Condition:
'# CBBI = chart.CombinedBollingerBandIndicator
'# Period = UserInput.Integer = 126
'# Percent = UserInput.Single = 25
If CBBI.Value <= (1 + Percent / 100) * CBBI.MinClose(Period) AndAlso _
CBBI.Low <= Price.Last AndAlso Price.Last <= CBBI.High Then PassAttachments: gsn 49028.sfRuleRC - 10 KB, downloaded 784 time(s).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |