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 |

How to prevent multiple buy triggers on same day in backscanning Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
sundeep
Posted : Wednesday, May 27, 2009 12:47:58 AM
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

Bruce_L
Posted : Thursday, May 28, 2009 12:24:06 PM


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
sundeep
Posted : Thursday, May 28, 2009 11:59:25 PM
Registered User
Joined: 3/9/2006
Posts: 39
Great! Thanks Bruce.
Bruce_L
Posted : Friday, May 29, 2009 7:29:39 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.