Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Order in the past

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Order in the past

    Hi,

    I have a strategy for DAX / FDAX. I've set the conditions only to enter trades between 9:15 and 17:30:

    if (ToTime(Time[0]) < tradetimeend
    && ToTime(Time[0]) > tradetimestart)
    {
    // Closes[1][0] refers to Dax dataseries current bar close
    if (
    Closes[1][0] >= EntryLong+0.5
    )
    {
    EnterLong(DefaultQuantity, "LO");
    }
    the strategy enters a trade when a certain value in the index is reached.
    sometimes it happens that the value is reached immediately at 9:00. because of the timefilter my strategy doesn't trade until 9:15. Exactly at 9:15 is takes the trade anyhow, although the condition was valid at 9:00 and not valid at 9:15. What can I do to prevent it from taking the trade at 9:15.

    #2
    Hi clint2008, this happens because your condition for entry is still true and when then your time filter allows trading, the trade is entered. You will have to rewrite your entry condition for example with a cross over rule.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Isn't there any other option to rewrite, the crossover is automaticly waiting for the bar to complete, I wouldn't want that.

      Isn't there something like the event occured n bars ago? I couldn't find it in the documentation.

      Comment


        #4
        Hi clint2008, you mean like -

        Least Recent Occurence - http://www.ninjatrader-support.com/H...urenceLRO.html

        or Most Recent Occurence - http://www.ninjatrader-support.com/H...urenceMRO.html
        BertrandNinjaTrader Customer Service

        Comment


          #5
          The usermanual states that MRO / LRO will not work in Multi-Instrument situations. Do you have any other suggestions?

          Thanks,
          clint2008

          Comment


            #6
            Hello,


            You will probably need to loop back to check using a "for" loop.
            DenNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kevinenergy, 02-17-2023, 12:42 PM
            123 responses
            2,883 views
            1 like
            Last Post SilverSurfer1  
            Started by warpinator, Yesterday, 10:44 AM
            2 responses
            19 views
            0 likes
            Last Post warpinator  
            Started by rayyyu12, Today, 03:59 PM
            0 responses
            10 views
            0 likes
            Last Post rayyyu12  
            Started by calmcosmia, Today, 03:07 PM
            4 responses
            14 views
            0 likes
            Last Post calmcosmia  
            Started by Tim-c, Today, 02:34 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X