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 within an indicator when InputSeries is not Close

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

    Time within an indicator when InputSeries is not Close

    E.g. I add the following line to the Bollinger indicator:

    Print(Time[0].ToString());

    This works fine if the input series is Close. However, if I use something else for the input series (i.e. another indicator) then I get the following output, for the time:

    01/01/1800 00:00:00

    #2
    Hello AntiMatter,

    This is going to be due to the Indicator that you pass it is not going to have any time stamps unlike a Series like Close, High, Low, Open.

    You may want to either pass it a DateTime variable so that you have something that you can reference, or use a global object like DateTime.Now to get your Local PC Clock time.

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      I'm trying to pass it a DateTimeSeries as a paramater - could this work?

      I'm trying to write a variant of Bollinger which takes the time of day into account. I have added the following to the script:

      Code:
              [Description("myDateTime")]
              [GridCategory("Parameters")]
              public DateTimeSeries MyDateTime
              {
                  get { return myDateTime; }
                  set { myDateTime = value; }
              }
      When I call the indicator (i.e. from another script), I am passing it a DateTime Series that I have created as such:
      myDateTimeSeries = new DateTimeSeries(this, MaximumBarsLookBack.Infinite);
      ...
      Add(BollingerMorning(Ratio(true, symbol2, includeMultiplier), myDateTimeSeries, entryBandStdDev,spreadBandCalcHorizon));

      However, when tryint to print myDateTime[0], it is still not set correctly.

      Thanks

      Comment


        #4
        Hello AntiMatter,

        You may want to try to pass the variable "Time" and then declare a new ITimeSeries in your indicator instead.

        Let me know if that works easier for you.
        JCNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_JC View Post
          Hello AntiMatter,

          You may want to try to pass the variable "Time" and then declare a new ITimeSeries in your indicator instead.

          Let me know if that works easier for you.
          Hello!

          I know this post is a bit old, but it is exactly the problem I have right now. I'm trying to do so, but getting compile error all the times, I don't know how to pass Time as a parameter. Could someone elaborate a little bit the last answer and provide some code snippets?

          Thanks a lot and regards

          Comment


            #6
            Hello nickMat,

            Thank you for your post and patience.

            It appears there is not a means to pass the time from an indicator to another. In my tests I can have the time print proper from the base indicator but it will not call proper when called from another indicator as it results in 0.

            If anyone has some insight here, it is welcome.

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              Hello nickMat,

              Thank you for your post and patience.

              It appears there is not a means to pass the time from an indicator to another. In my tests I can have the time print proper from the base indicator but it will not call proper when called from another indicator as it results in 0.

              If anyone has some insight here, it is welcome.
              Have you tried running Update() in the getter for the Time that you are passing?

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by ZenCortexHurry, Today, 01:07 PM
              0 responses
              2 views
              0 likes
              Last Post ZenCortexHurry  
              Started by ZenCortexHurry, Today, 01:04 PM
              0 responses
              0 views
              0 likes
              Last Post ZenCortexHurry  
              Started by f.saeidi, Today, 12:14 PM
              3 responses
              9 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by Russ Moreland, Today, 12:54 PM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by philmg, Today, 12:55 PM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Working...
              X