Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error when using CancelOrder

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

    #16
    Hello RobotSyndicate,

    Put NinjaTrader.Core.Globals.Now in ToTime().

    Print(ToTime(NinjaTrader.Core.Globals.Now)); <-- this prints the current computer time represented as an integer.

    This is what I have suggested in Post #8.

    From the help guide:
    "ToTime(DateTime time)"

    It states this works with a DateTime object. NinjaTrader.Core.Globals.Now is a DateTime object with the current date and time.

    There is no bar information in what I have suggested.
    The the time of a bar is Time[0], which is not used in my suggestion.
    Last edited by NinjaTrader_ChelseaB; 06-29-2022, 11:31 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Ah yes, yes you did. Thank you Chelsea. Do you happen to know if I can pull out the day of the week as an integer from NinjaTrader.Core.Globals.Now as can be done with DateTime? Like with DateTime I would do:

      DateTime now = DateTime.Now;
      weekDay = (int)now.DayOfWeek;

      to get a 0-6 value for the int weekDay.

      thanks for all you do!

      Comment


        #18
        Hello RobotSyndicate,

        Yes, Core.Globals.Now is a DateTime object. Use it the way you would any other DateTime object.

        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        71 views
        0 likes
        Last Post PaulMohn  
        Working...
        X