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

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 selu72, Today, 02:01 PM
    0 responses
    0 views
    0 likes
    Last Post selu72
    by selu72
     
    Started by f.saeidi, Today, 12:14 PM
    8 responses
    18 views
    0 likes
    Last Post f.saeidi  
    Started by Mikey_, 03-23-2024, 05:59 PM
    3 responses
    49 views
    0 likes
    Last Post Sam2515
    by Sam2515
     
    Started by Russ Moreland, Today, 12:54 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by philmg, Today, 12:55 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Working...
    X