Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 23
|
I need a little help in writing a realcode rule, for an intra-day chart (15 minute chart in my case)1) Price is after making a new low (15 minute low bar), a new low for today and yesterday’s trading range. Call this the “low bar”.2) I want the rule to trigger when price (15 minute bar) is crossing up through the high of “low bar”, anytime in today’s trading range.Example stocks to look at: MELI, Tuesday 10.12.2010 The first candle (9:00 – 9:15) was lowest low candle in today and yesterday’s trading range, I want the rule to trigger when price starts to cross above $62.34 (the high of the 15 minute low bar). It would have triggered between 10:45 - 11:00am.GOLD Tuesday 10.12.2010 The second 15 minute candle (9:15 – 9:30) was lowest low candle in today and yesterday’s trading range, I want the rule to trigger when price starts to cross above $101.44 (the high of the 15 minute low bar). It would have triggered a number of times in this stocks case, between 10:00 - 10:15am, 10:15 - 10:30am, and 10:30 -10:45am each time as it crossed up through $101.44.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Price Crossing up through a Low
'|******************************************************************
Static DayLow(1) As Single
Static HighofLow As Single
Static Days As Single
If isFirstBar Then
DayLow(1) = Single.NaN
HighOfLow = Single.NaN
Days = 0
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
DayLow(1) = DayLow(0)
DayLow(0) = Single.MaxValue
HighOfLow = Single.NaN
Days += 1
End If
If Price.Low < DayLow(0) Then
DayLow(0) = Price.Low
If Price.Low < DayLow(1) Then
HighOfLow = Price.High
End If
End If
If Days >= 2 Then
If Price.High > HighOfLow AndAlso _
(Price.Last(1) <= HighOfLow OrElse _
Price.Low <= HighOfLow) Then
Pass
End If
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 23
|
Bruce, Thank you for your help, that rule was exactly what I was looking for.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |