Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

price surpasses opening bars high... Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Surfrider67
Posted : Thursday, March 15, 2012 1:25:15 PM
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.

Bruce_L
Posted : Thursday, March 15, 2012 1:51:16 PM


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
Surfrider67
Posted : Thursday, March 15, 2012 2:00:11 PM
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?

Bruce_L
Posted : Thursday, March 15, 2012 2:02:36 PM


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
Surfrider67
Posted : Thursday, March 15, 2012 2:08:06 PM
Registered User
Joined: 10/31/2010
Posts: 106

got it, thanks again...

Bruce_L
Posted : Thursday, March 15, 2012 2:09:43 PM


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
Posted : Thursday, March 15, 2012 4:08:50 PM
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.

 

Bruce_L
Posted : Thursday, March 15, 2012 4:31:36 PM


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
Surfrider67
Posted : Friday, March 16, 2012 7:32:25 PM
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?

Bruce_L
Posted : Monday, March 19, 2012 11:17:07 AM


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
Surfrider67
Posted : Monday, March 19, 2012 6:13:14 PM
Registered User
Joined: 10/31/2010
Posts: 106

perfect - thank you again!

Bruce_L
Posted : Tuesday, March 20, 2012 8:59:56 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.