Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 56
|
Hi Bruce,
I want to scan for stocks that are making a new high (and low in another scan) of the day at certain times of the day. For example
If last is new high of day and time is between 1 PM and 2 PM then pass
Can that be done? Thanks in advance.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The following RealCode Condition should return for any bars on an intraday chart which have new highs between 1:00 PM and 2:00 PM ET.
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:New High Between Times
'|******************************************************************
'# Cumulative
Static DayHigh As Single
Static DayLow As Single
If isFirstBar Then
DayHigh = Single.NaN
DayLow = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
DayHigh = Price.High
DayLow = Price.Low
End If
If Price.High > DayHigh Then
DayHigh = Price.High
If Date.Parse("13:00").TimeOfDay <= Price.DateValue.TimeOfDay AndAlso _
Price.DateValue.TimeOfDay <= Date.Parse("14:00").TimeOfDay Then
Pass
End If
End If
If Price.Low < DayLow Then
DayLow = Price.Low
End If
You can change the "13:00" and "14:00" in the RealCode to change the start and end times. You would need to put something similar in the If Price.Low < DayLow Then section to do something similar for new lows.
You could use the RealCode Condition as a Rule in BackScanner to backtest it.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 56
|
Bruce, you ROCK!!
going to work on implementing it now.
|
|
Registered User Joined: 10/7/2004 Posts: 56
|
Hi Bruce,
what does "'# Cumulative" do?
and I would like to use this as an indicator and condition, is there any reason why I can't
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The '# Cumulative line lets StockFinder know to use all of the available data for the calculations instead of trying to optimize the condition by using less data when it isn't being used on the chart.
The RealCode Condition is just that, a condition (which can be used in the same way as any other condition) and not an indicator, but I cannot think of any reasons you could not plot the RealCode Condition as True Markers on the chart.
Just drag and drop the condition onto the chart or right-click on the condition and select Show True Markers (you can right-click on the condition and select Edit True Markers to change the settings).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |