Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

5 seconds

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

    5 seconds

    I have "CalculateOnBarClose = true" in my strategy as well as the UI. My orders seem to occur approximately 5 or 6 seconds before close of bar. I also have the buy/sell orders nested within "BarsInProgress == 0".

    This does not amount to anything significant but I'm curious as to why/how this occurs. Any ideas?

    #2
    If you are running a strategy with CalculateOnBarClose set to true, then this is executing at the close of the bar. Is it possible that you are measure the close of a bar against your PC clock and your PC clock might be ahead by 5 or 6 seconds?
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray for the reply. Thats what I thought for a while but I am using "DateTime.Now" in my sendmail method upon order entry so something seems amiss unless "DateTime.Now" uses my PC clock. It is the "DateTime.Now" time that I am referring to and not the time the email was sent.

      Also, when I backtest this strategy the order entrys reflect the open of the next bar (as expected upon bar close), when run real time the orders reflect close of current bar albiet 5 seconds to go to the open of the next bar to mirror the backtesting result.

      Although 5 or 6 seconds doesn't really matter, I don't quite understand why this is occuring.

      Does "DateTime.Now" use my PC clock?

      Comment


        #4
        eleven, this is correct - DateTime.Now is your PC clock, so best would be to sync it up with an Internet time server and recheck the issue.

        Comment


          #5
          Thanks Ray and Bertrand for the prompt replies.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          51 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          142 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          160 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          96 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          275 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Working...
          X