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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        72 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        39 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X