Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

if(ToTime(Time[0]) == 22000) not never true

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

    if(ToTime(Time[0]) == 22000) not never true

    Hi,

    Im using if(ToTime(Time[0]) == 22000) on 5 min bars to check for the end of day and then cancel any orders but for some reason it never gets processed, ie never true, does any one know why this is ?

    #2
    Hi GKonheiser,

    Thank you for your post.

    Are you running the script with CalculateOnBarClose set to True or False?

    Is the 220000 the end of the session time for the instrument that you are using?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      yup, CalculateOnBarClose is set to true and 22000 is the end of session.

      Comment


        #4
        Originally posted by GKonheiser View Post
        Hi,

        Im using if(ToTime(Time[0]) == 22000) on 5 min bars to check for the end of day and then cancel any orders but for some reason it never gets processed, ie never true, does any one know why this is ?
        The time that you have specified is 2:20 AM local time in the morning. Is that what you intended?

        Comment


          #5
          GKonheiser,

          Additionally, with the COBC set to true you would have to wait til the end of the 22000 bar to close before it will be process and calculated. This comes to the issue that the last tick of the bar is the first tick of the next bar. Since. this is the session close that bar will not be officially closed til the open of the next day.
          Cal H.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Cal View Post
            GKonheiser,

            Additionally, with the COBC set to true you would have to wait til the end of the 22000 bar to close before it will be process and calculated. This comes to the issue that the last tick of the bar is the first tick of the next bar. Since. this is the session close that bar will not be officially closed til the open of the next day.

            Ah Ok thats a problem, what is the best method then to cancel all orders at the end of the day then?

            Comment


              #7
              Originally posted by koganam View Post
              The time that you have specified is 2:20 AM local time in the morning. Is that what you intended?

              Hi, no that's not what I wanted, I thought that would be 10PM, what is 10PM then?

              Comment


                #8
                GKonheiser,

                You need to add an 0 at the end of that time you are testing.
                The format for that is HHMMSS
                This is also held on a 24 hour clock system
                10pm would be 220000

                Additionally. if you are going to the end of the session you can use ExitOnClose to cancel all strategy generated orders and open positions.
                http://www.ninjatrader.com/support/h...xitonclose.htm
                Cal H.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                649 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                370 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                109 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                573 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                576 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X