Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time Filter

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

    Time Filter

    Hey guys,

    I don't want my strategy to trade between 3:15 PM CST and 7:00 PM CST. I have the following code in my OnBarUpdate()

    if((ToTime(Time[0]) >= 151500 && ToTime(Time[0]) < 190000))
    {
    return;
    }

    yet the strategy placed an order last night at 6:30 PM CST.

    In backtests it seems to perform correctly. Any ideas?

    Shiptastic

    #2
    If you had limit/stop orders in play before the time filter they can persist and become filled inside that time frame. You will want to cancel out of all open orders prior to the time filter. Other than that you would want to use TraceOrders = true to fully understand what is happening.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Good point about the limit orders but this was a market order that should not have been executed. I also have traceorders on but I can't seem to see anything that would indicate a problem...other than the time of course. Is it possible that Ninja is thinking in EST or day light savings time, or some other weird phenomenon.

      Comment


        #4
        Well, what does the TraceOrders say? What time was the order submitted?

        There should be a line where it goes something like "Entered internal PlaceOrder".
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Unfortunately after that happened I shut down Ninja and reset my db. I've lost the log, but at the time I believe it said the current time. Obviously this isn't definitive proof, and I won't know until tonight if something like that happens again.

          Is there any way to retrieve that log now?

          Comment


            #6
            Unfortunately not the TraceOrders output. I suggest you keep an eye on it tonight and see what happens.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            662 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            376 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            110 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            580 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X