Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 6/30/2009 Posts: 57
|
I wish to create an indicator that does the following in StockFinder:
Count of new daily 52 week highs in price / count of number of isssues traded for whatever given watch list or exchange I have specificed
Any suggestions would be greatly appreciated.
Doug
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could select Add Indicator/Condition to Chart | Count Percent New Highs Indicator.
Working with Indicators
You could also create a Condition for a New High:
Creating Conditions
Writing Conditions in RealCode
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:New High
'|******************************************************************
'# Period = UserInput.Integer = 251
If CurrentIndex > Period Then
If Price.High > Price.MaxHigh(Period, 1) Then
Pass
End If
Else
SetIndexInvalid
End If
And then right-click on the Condition and select Create Market Indicator | Active WatchList | Next | Percent Passing | Next | Finish.
Market Indicators from Conditions
Custom Market Indicators
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2009 Posts: 57
|
Hi Bruce,
Thanks for your response.
With regards to the indicator "Count Percent New Highs Indicator" what is the denominator for the calculation? Is it for all instruments in the watchlist/exchange or all instruments that were actually traded in the watchlist/exchange. I was unable to tell from the Stockfinder Help.
Thanks,
Doug
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It would be for all instruments with Price Bars for the date in question. I haven't tested to see if there must also be enough data to calculate the High Period or not, but would suspect this is a requirement from previous testing on the List Percent True Block used in its calculations. In general if the Boolean Condition used in the calculations has a valid result, it is used in the denominator and if it both has a valid result and returns True it is used in the numerator.
This would include symbols with zero volume for that day, but would not necessarily include every symbol in the Watchlist. For example, an IPO after the date in question would mean the symbol would not be counted. If you had a mixed list of Canadian and US symbols with different Market Holidays, you could have days generated entirely from Canadian symbols or entirely from US symbols. So they need to have been tradable on the day, but not necessarily actually traded.
I think we could use the Market Index method to only include symbols that actually traded by using SetIndexInvalid if Volume is zero:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:New High
'|******************************************************************
'# Period = UserInput.Integer = 251
If CurrentIndex > Period AndAlso Volume.Value > 0 Then
If Price.High > Price.MaxHigh(Period, 1) Then
Pass
End If
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2009 Posts: 57
|
Now that's weird - I receive a compiler error on the "Pass" command.
Says "Name 'Pass' is not recongized."
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It reads like you are using the RealCode as an Indicator instead of as a Condition. The Pass syntax is not valid as part of a RealCode Indicator.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2009 Posts: 57
|
Oops - that would make a difference. :(
However, when I create it as a condition instead - the interpreter barks at the "period" definition. Do I need to create a "Dim Period as single" or something like that?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You definitely don't want to use a Dim statement to create the Period line as it is already created in the following line:
'# Period = UserInput.Integer = 251
Just copy and paste the whole thing (including the six lines at the beginning which start with ') from the forums into StockFinder 5. You don't even need to open a RealCode Editor. Just right-click on the Chart itself and select Paste.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2009 Posts: 57
|
Hmm - recopied the source code a couple of times and the error messages went away.
The indicator now works off the condition and the results are plotted.
Just need to verify my results.
Thanks Bruce!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |