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 Felix Reichert, 04-26-2024, 02:12 PM
            10 responses
            68 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by PaulMohn, 04-24-2024, 03:49 AM
            4 responses
            36 views
            0 likes
            Last Post PaulMohn  
            Started by lightsun47, Today, 11:37 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by vitaly_p, Yesterday, 05:09 PM
            4 responses
            35 views
            0 likes
            Last Post vitaly_p  
            Started by bortz, 11-06-2023, 08:04 AM
            50 responses
            1,773 views
            0 likes
            Last Post carnitron  
            Working...
            X