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 Balage0922, Today, 07:38 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post Balage0922  
                  Started by JoMoon2024, Today, 06:56 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post JoMoon2024  
                  Started by Haiasi, 04-25-2024, 06:53 PM
                  2 responses
                  19 views
                  0 likes
                  Last Post Massinisa  
                  Started by Creamers, Today, 05:32 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post Creamers  
                  Started by Segwin, 05-07-2018, 02:15 PM
                  12 responses
                  1,786 views
                  0 likes
                  Last Post Leafcutter  
                  Working...
                  X