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

Order tab and time zone.

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

    Order tab and time zone.

    I think there might be a bug in time column on order tab in control center. Local time set to MT on charts however order execution time still shows CT. Or am I missing a setting?

    #2
    What time setting do strategies use? The one we set via tools options or CT always? I have configured times not to trade in settings.

    Comment


      #3
      Hello rocketstock,

      NinjaTrader uses the time zone that is setup at Control Center-->Tools-->Options-->General-->Time zone.

      Could it be you changed the Time zone setting, but you did not restart NinjaTrader?

      If you restart NinjaTrader and then perform a test order while connected to the Simulated Data Feed, does it show time as per the time zone selected?
      JasonNinjaTrader Customer Service

      Comment


        #4
        Thanks I'll try that in the meanwhile this is the setting I have. I want to avoid holding a position so that initial and maintenance margin don't kick in.

        For long and short - only enter if time is before 2:29 MT or after 4:03 PM MT

        Times[Default input][0].TimeOfDay < new TimeSpan(14, 29, 0)
        Times[Default input][0].TimeOfDay > new TimeSpan(16, 3, 0)


        For close - close everything before 2:30 MT if any position are open account. Close all long and short between 2:29 and 2:30 MT

        Times[Default input][0].TimeOfDay >= new TimeSpan(14, 29, 0)
        Times[Default input][0].TimeOfDay <= new TimeSpan(14, 30, 0)
        Position.MarketPosition != MarketPosition.Flat

        Would these be correct to avoid any initial and maintenance margin?
        Last edited by rocketstock; 02-06-2022, 03:41 PM.

        Comment


          #5
          Hi rocket, Please confirm with your broker the exact times. The logic for the time filter is correct. You can also test to make sure the filter works by running the strategy over the Playback connection. There is also a built-in setting for the strategy called ExitOnSessionClose and ExitOnSessionClose seconds that will automatically close any open positions.

          Kind regards,
          -ChrisL
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Thanks Chris. I will do that.

            Meanwhile I tried putting another time logic that wont compile the script. This is for not trading after Friday after market close 1:58 pm MT. Would you able to help?

            All conditions below need to meet to open position.

            Times[0][0].TimeOfDay.DayOfWeek != DayOfWeek.Friday
            Times[Default input][0].TimeOfDay < new TimeSpan(13, 58, 0)


            Comment


              #7
              Hi rocket, there is a full example of setting up a time filter here:



              The correct syntax for the snipped you posted is:
              if(Times[0][0].DayOfWeek != DayOfWeek.Friday
              && Times[0][0].TimeOfDay < new TimeSpan(13, 58, 0))
              {

              }

              Kind regards,
              -ChrisL
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                Hi Chris sorry forgot to mention. that was from strategy builder. I didnt code it. I'll try and make it look like yours in strategy builder. Thanks.

                Comment


                  #9
                  worked i needed to use date series in strategy builder instead of time.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by WHICKED, Today, 12:56 PM
                  2 responses
                  15 views
                  0 likes
                  Last Post WHICKED
                  by WHICKED
                   
                  Started by Felix Reichert, Today, 02:12 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post Felix Reichert  
                  Started by Tim-c, Today, 02:10 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post Tim-c
                  by Tim-c
                   
                  Started by cre8able, Today, 01:16 PM
                  2 responses
                  9 views
                  0 likes
                  Last Post cre8able  
                  Started by chbruno, 04-24-2024, 04:10 PM
                  3 responses
                  49 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Working...
                  X