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 setting.

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

    #16
    Originally posted by Ralph View Post
    Now I understand, what you mean. I defined in my code example a variable with the name "Stop", but used a variable with the name "End". Yes, you need to change either the used name or the defined name. I didn't test the code myself.

    Regards
    Ralph
    Fine. So it should be OK. Thanks a lot.
    Rgds
    Czarek

    Comment


      #17
      Hallo Ralph
      I have one more question to the sample you send me time ago[CODE]DateTime Start = DateTime.MaxValue
      DateTime Stop = DateTime.MinValue
      ...
      if(ToTime(Time[0]) == ToTime(20,45,0))
      {
      Start = Time[0]
      Stop = Start.AddMinutes(405)
      }
      ...
      if(Time[0] >= Start && Time[0] <= End)
      {
      here we go
      }/CODE]

      How to make variable represent 20,45,00 ??
      Rgds
      Czarek.

      Comment


        #18
        You could just drop the ToTime(20,45,0) and just make an int variable

        int someVar = 204500;
        if (ToTime(Time[0]) == someVar)
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          Hello.
          I make the coded time setting according this sample:
          [CODE]DateTime.MaxValue
          DateTime Stop = DateTime.MinValue
          ...
          if(ToTime(Time[0]) == ToTime(20,45,0))
          {
          Start = Time[0]
          Stop = Start.AddMinutes(405)
          }
          ...
          if(Time[0] >= Start && Time[0] <= End)
          {
          here we go
          }/CODE]/CODE]
          I works well on the computer I create the strategy.
          When I transfer strategy to another compter problems apperaed.
          I got 2 different results in output windows:
          Here works well:
          Code:
          7/8/2009 3:52:48Start =31/12/9999 23:59:59
          7/8/2009 3:52:48Stop =1/1/0001 0:00:00
          Here does not work;
          Code:
          7/8/2009 3:52:48Start =6/8/2009 23:59:59
          7/8/2009 3:52:48Stop =6/8/2009 0:00:00
          I already check the local time date setting on both computers are same.

          Where can I fix this setting.

          Rgds
          Czarek

          Comment


            #20
            Czarek, are you sure code is running on exactly the same set of historical data? Please try to reload the data on the PC where you got an unexpected result and retry.
            BertrandNinjaTrader Customer Service

            Comment


              #21
              Hi Czarek,

              not sure what you are describing in your code snippets.

              7/8/2009 3:52:48Start =31/12/9999 23:59:59
              7/8/2009 3:52:48Stop =1/1/0001 0:00:00

              The numbers above represent the DateTime.MaxValue and DateTime.MinValue.

              7/8/2009 3:52:48Start =6/8/2009 23:59:59
              7/8/2009 3:52:48Stop =6/8/2009 0:00:00

              And these numbers above represent something based on some calculations: Two time-stamps with a distance of nearly 24 hours.

              ???

              Regards
              Ralph

              Comment


                #22
                Ralph.
                This is what have been shown in output window on two different computers.
                Same code works in different on different computers. Both has same data time system setting. I do not know why same code works different.
                I just add ToDay to the code and the problem gone.
                [CODE]if(ToTime(Time[0]) == ToTime(20,45,0)) && (ToDay(Time[0]) >= 20090807)CODE]
                Rgds
                Czarek

                Comment


                  #23
                  Speculation, but different computers could have different data therefore evaluating slightly differently.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Here is another observation: If the print of the results displays the initial values (MinValue, MaxValue), then the if-condition was not hit.
                    A statement like:

                    if(ToTime(Time[0]) == ToTime(20,45,0))

                    may work for a 15-minute-chart but may not work for a 10-minute-chart. An alternate solution could be:

                    if(ToTime(Time[0]) >= ToTime(20,45,0))

                    Regards
                    Ralph

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cyberpete76, 03-27-2023, 12:29 AM
                    7 responses
                    267 views
                    1 like
                    Last Post slightly  
                    Started by renewsaltwater, Today, 01:15 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post renewsaltwater  
                    Started by slightly, Today, 12:49 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post slightly  
                    Started by sdauteuil, 09-23-2021, 10:16 AM
                    4 responses
                    1,210 views
                    0 likes
                    Last Post jacobpescaia44  
                    Started by agclub, 04-21-2024, 08:57 PM
                    5 responses
                    39 views
                    0 likes
                    Last Post agclub
                    by agclub
                     
                    Working...
                    X