Registered User Joined: 3/9/2006 Posts: 39
|
Dear Worden Trainers,
Using intra-day price data (e.g., 5 minute bars), I can easily create a buy rule that fires when price closes above a value. How do I prevent multiple buy orders from triggering on same day?
In other words, I'd like to have a buy rule that fires only once (the first time) on any trading day.
thanks,
Sundeep
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could create a variable to check if the Rule has returned True previously at some point during the day. The Triggered variable does so in the following RealCode Rule for example:
'# AboveValue = UserInput.Single = 10
Static Triggered As Boolean
If isFirstBar OrElse _
Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
Triggered = False
End If
If Triggered = False Then
If Price.Last > AboveValue Then
Pass
Triggered = True
End If
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 3/9/2006 Posts: 39
|
Great! Thanks Bruce.
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|