Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/31/2010 Posts: 106
|
Need help with the following please:
Price surpasses the opening bars high after a minimum of one bar in between.
And-
Price breaks low of opening bars low after a minimum of one bar in between. (both intraday of course)
Thank you.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I can think of a variety of possible interpretations, but you could create a RealCode Condition for the High crossing up through the High of the opening Bar as:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Cross Up Opening High
'|******************************************************************
Static OpeningHigh As Single
If isFirstBar Then
OpeningHigh = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
OpeningHigh = Price.High
End If
If Single.IsNaN(OpeningHigh) Then
SetIndexInvalid
Else If Price.High > OpeningHigh AndAlso _
Price.High(1) < OpeningHigh Then
Pass
End If
And a RealCode Condition for the Low crossing down through the Opening Low as:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Cross Down Opening Low
'|******************************************************************
Static OpeningLow As Single
If isFirstBar Then
OpeningLow = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
OpeningLow = Price.Low
End If
If Single.IsNaN(OpeningLow) Then
SetIndexInvalid
Else If Price.Low < OpeningLow AndAlso _
Price.Low(1) > OpeningLow Then
Pass
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/31/2010 Posts: 106
|
Thank you Bruce,
do these conditions include a minimum of a one bar interval between the opening bar and the bar that
breaks the high of the opening bar?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
They don't explicitly include such a requirement, but since they check for the high to be above opening high during the current bar and below during the previous bar or the low to below the opening low during the current bar but above the opening low during the previous bar, they can't be true on the second bar of the day.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/31/2010 Posts: 106
|
got it, thanks again...
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome. If it ends up not meeting your particular needs, we can refine the definition somewhat and then change the RealCode.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest
Joined: 9/18/2004 Posts: 247
|
Excellent, so can they be written to deactivate after 2 signals?
That is to say, after the second signal is given the condition stops checking. And no more signals are given for that day.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could try:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Cross Up Opening High
'|******************************************************************
Static OpeningHigh As Single
Static Count(1) As Integer
If isFirstBar Then
OpeningHigh = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
OpeningHigh = Price.High
Count(0) = 0
Count(1) = 0
End If
Count(0) += 1
If Single.IsNaN(OpeningHigh) Then
SetIndexInvalid
Else If Price.High > OpeningHigh AndAlso _
Price.High(1) <= OpeningHigh AndAlso _
Count(0) >= 3 AndAlso _
Count(1) <= 1 Then
Count(1) += 1
Pass
End If
And:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Cross Down Opening Low
'|******************************************************************
Static OpeningLow As Single
Static Count(1) As Integer
If isFirstBar Then
OpeningLow = Single.NaN
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
OpeningLow = Price.Low
Count(0) = 0
Count(1) = 0
End If
Count(0) += 1
If Single.IsNaN(OpeningLow) Then
SetIndexInvalid
Else If Price.Low < OpeningLow AndAlso _
Price.Low(1) >= OpeningLow AndAlso _
Count(0) >= 3 AndAlso _
Count(1) <= 1 Then
Pass
Count(1) += 1
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/31/2010 Posts: 106
|
This is great Bruce, do you mind one more tweak?
Is it possible for this condition to trigger a given amount, say 5 points prior to the breaking of
the high (or low). If yes, can I just step in to the realcode interface and change that five to a different
number?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I'm guessing to a great deal as to your intent, but you might want to try changing:
Else If Price.Low < OpeningLow AndAlso _
Price.Low(1) >= OpeningLow AndAlso _
To:
Else If Price.Low < OpeningLow - .05 AndAlso _
Price.Low(1) >= OpeningLow - .05 AndAlso _
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/31/2010 Posts: 106
|
perfect - thank you again!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |