Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time and day filters

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

    Time and day filters

    Hey all,

    I am looking to close any open positions and prevent entry between the times of 1224 and 1235 on Friday. I am using a 60 minute chart, with calculate on close = False.

    What I have is the following;

    Code:
    if (Time[0].DayOfWeek == DayOfWeek.Friday && (ToTime(Times[0]) >= 122400 && ToTime(Time[0]) <= 123500))
    				{
    						ExitShort();
    						ExitLong();
    				}
    				
    				else
                                    {
                                                    // Do something
                                    }
    I can't get this time filter to work in Market Replay, what is it that I am missing?

    #2
    Hello,
    I would first recommend, if you haven't already, to add a print to check that that time filter is
    working. You could do something like Print("Time filter is working Bar Time is " + Time[0]); If you are unfamiliar with working with prints to debug please see the following link: http://ninjatrader.com/support/forum...ead.php?t=3418

    Once you have checked using the print that your time filter is working then that could mean that there is an error with getting the orders to exit. It would be recommended to use TraceOrders to track what the orders are doing and checking for any errors that occurring when the exit orders are submitted. Please see the following link on working with TraceOrders: http://ninjatrader.com/support/forum...ead.php?t=3627
    Cody B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X