Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 8/29/2005 Posts: 16
|
Can I use stockfinder to search for a low based on a 30 minute bar at 12:30 or some other time?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I'm not sure I understand the request. Are you just looking for the Low of the 12:30 30-Minute Bar or are you looking for the Low of the Day up through the 30-Minute Bar?
The following RealCode Indicator checks for the Bar to be 12:30 and changes its Value to the Low at that point each day. It will not Plot for Time Frames without 12:30 Bars.
Static Low1230 As Single
If isFirstBar Then
Low1230 = Single.NaN
End If
If Price.DateValue.Minute = 30 AndAlso _
Price.DateValue.Hour = 12 Then
Low1230 = Price.Low
End If
Plot = Low1230
The following RealCode Indicator returns the Low of the Day starting with the first Bar until after 12:30 at which point it returns the Low of the Day up through the last bar that was 12:30 or less. This means it might not be the Low up through 12:30 if there is no 12:30 Bar.
Static Low1230 As Single
Static Valid(1) As Boolean
If isFirstBar Then
Low1230 = Single.NaN
Valid(0) = False
Valid(1) = False
End If
If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
Low1230 = Price.Low
Valid(0) = True
End If
If Price.DateValue.Hour < 12 OrElse _
(Price.DateValue.Hour = 12 AndAlso _
Price.DateValue.Minute <= 30) Then
Low1230 = System.Math.Min(Low1230, Price.Low)
Else If Valid(0) = True Then
Valid(1) = True
End If
If Valid(1) Then
Plot = Low1230
Else
Plot = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/29/2005 Posts: 16
|
Thank you for your reply. I want to run the scan to only identify those stocks where 1) the low of the day is above or equal to the low of the say 12:30 bar. So if the low is 65 and the 12:30 bar low is 66 then this stock would not appear in the results. I also want the low of this bar to be above yesterday's high. If we are at 1 PM and the low of the day is below the 12:30 bar low than it would drop off of the list. I am assuming the 12:30 bar represents the trading activity from 12:00 until 12:30. Thank you
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (acastel1) I want to run the scan to only identify those stocks where 1) the low of the day is above or equal to the low of the say 12:30 bar. So if the low is 65 and the 12:30 bar low is 66 then this stock would not appear in the results.
For this to be literally True, the 12:30 Bar must be the lowest Bar of the Day. In other words, all Bars before and after the 12:30 Bar must have a Low that is greater than or equal to the 12:30 Bar. This is quite restrictive. That said, the following RealCode Rule interprets the request literallly.
Static LowOfDay As Single
Static HighOfDay(1) As Single
Static Low1230 As Single
Static Count As Integer
Static Valid As Boolean
If isFirstBar Then
LowOfDay = Price.Low
HighOfDay(1) = Single.NaN
HighOfDay(0) = Price.High
Low1230 = Single.NaN
Count = 0
Valid = False
Else If Price.DateValue.DayOfYear <> Price.DateValue.DayOfYear Then
LowOfDay = Price.Low
HighOfDay(1) = HighOfDay(0)
HighOfDay(0) = Price.High
Low1230 = Single.NaN
Count += 1
End If
LowOfDay = System.Math.Min(LowOfDay, Price.Low)
HighOfDay(0) = System.Math.Max(HighOfDay(0), Price.High)
If Price.DateValue.Hour = 12 AndAlso _
Price.DateValue.Minute = 30 Then
Low1230 = Price.Low
If Count >= 2 Then Valid = True
End If
If Valid = True Then
If LowOfDay >= Low1230 AndAlso _
Low1230 > HighOfDay(1) Then
Pass
End If
Else
SetIndexInvalid
End If
QUOTE (acastel1) I also want the low of this bar to be above yesterday's high.
I'm going to assume "this bar" meas the 12:30 Bar. If it means the current Bar instead, you will need to change the following line:
Low1230 > HighOfDay(1) Then
To:
Price.Low > HighOfDay(1) Then
In the RealCode Rule provided above.
QUOTE (acastel1) I am assuming the 12:30 bar represents the trading activity from 12:00 until 12:30.
This should be True as long as your are using 30-Minute Bars.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |