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

time zone in script?

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

    time zone in script?

    Wonder if you could help me out here?
    Sorry, Ive sorted it, but dont understand the timezone comment?

    The script has a comment on Time zones and I need to set it to GMT 0 as in London,England.
    where do you set it ?

    if (Time[0].DayOfWeek != DayOfWeek.Monday && Time[0].DayOfWeek != DayOfWeek.Friday)
    {
    /* Checks to see if the time is during the busier hours (format is HHMMSS or HMMSS). Only allow trading if current time is during a busy period.
    The timezone used here is (GMT-05:00) EST. */
    if ((ToTime(Time[0]) >= 93000 && ToTime(Time[0]) < 120000) || (ToTime(Time[0]) >= 140000 && ToTime(Time[0]) < 154500))
    {
    // Entry Signal: If current close greater than previous close, enter long
    if (Close[0] > Close[1])
    EnterLong();
    }
    }
    The first time slot looks like 9-30am to 12pm then 2pm to 3-45? but where do you set the time zone?
    Thanks in advance
    Last edited by fredfred123; 11-05-2017, 08:55 AM.

    #2
    Hello fredfred123,

    The time zone NinjaTrader uses (for Time[0] and for charts) will be the time zone set on your PC clock.

    What is the time zone of your PC clock?

    To set the time zone of NinjaTrader you will need to shut down NinjaTrader, then change the time zone of your PC clock (change the time zone setting, don't manually change the time).
    Below is a link to detailed steps to change the time zone.


    If you want to convert the time to a time zone that is different than your computer time zone you can use TimeZoneInfo.ConvertTime().
    Below is a publicly available link to the microsoft documentation on TimeZoneInfo.ConvertTime.



    The comment may be coming from a 3rd party script you have imported. The programmer may be noting when the market is active in their local time zone and is noting why they used those specific times in the time filter condition.
    Last edited by NinjaTrader_ChelseaB; 11-05-2017, 12:15 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks,

      My PC is set to UTC+00:00 Dublin,London etc

      So the Time[0] will set to my time zone.

      The author of the script would probably set the times that he wants to trade,the [0] would set the timezone to his PC(GMT-05:00) EST.

      The settings in the time filter conditions now will be for my PC UTC+00:00 Dublin,London etc

      Hope I've understood!

      Thanks for your help

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by frankthearm, Today, 09:08 AM
      3 responses
      6 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by yertle, Today, 08:38 AM
      5 responses
      14 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by adeelshahzad, Today, 03:54 AM
      3 responses
      16 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by bill2023, Yesterday, 08:51 AM
      6 responses
      27 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
      80 responses
      19,667 views
      5 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X