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

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, Today, 01:27 AM
        0 responses
        4 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by EB Worx, 03-07-2023, 05:05 AM
        4 responses
        97 views
        1 like
        Last Post cls71
        by cls71
         
        Started by patricia70, 11-23-2020, 10:17 AM
        17 responses
        546 views
        1 like
        Last Post PaulMohn  
        Started by Jltarrau, 04-28-2024, 10:18 PM
        1 response
        14 views
        0 likes
        Last Post brucerobinson  
        Started by zencortexuss, Today, 12:45 AM
        0 responses
        8 views
        0 likes
        Last Post zencortexuss  
        Working...
        X