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

What is Input ?

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

    What is Input ?

    Here wrote about Input. What it is? I can't underastand about application of Input.Explain me , please, about it. Where it use in practice...

    #2
    Hello,

    Input is the collection of Input IDataSeries a item has.
    To ensure I am referring to the same as you are, this is the Input I am describing: http://www.ninjatrader.com/support/h.../nt7/input.htm

    An example of this is the SMA(IDataSeries, Period)
    The IDataSeries could be Close prices for example, so we have :

    Code:
    double someValue = SMA(Close, 12)[0];
    the code inside SMA indicator:

    Code:
    Value.Set(Input[0]);
    This line says to Set the CurrentBar's value from Input or Input[0]. Value is the generic name for the index 0 Plot of this indicator.

    also
    Code:
    Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
    else
    Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
    Is the calculation for the SMA using the input IDataSeries for its prices, this means that i could pass in Close, Open, High, Low, Volume or any IDataSeries value to the SMA indicator.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      An example of this is the SMA(IDataSeries, Period)
      The IDataSeries could be Close prices for example, so we have :

      Code:
      double someValue = SMA(Close, 12)[0];
      the code inside SMA indicator:

      Code:
      Value.Set(Input[0]);
      This line says to Set the CurrentBar's value from Input or Input[0]. Value is the generic name for the index 0 Plot of this indicator.
      Hi, It means, that if SMA take it's value from another( not primary) instrument( Bars object ), but from, for example, second( Bars object ), and I wrote so:
      Code:
      double someValue = SMA(Close, 12)[1];
      the cjde inside SMA indicator will be like this?
      Code:
      Value.Set(Input[1]);
      It is correctly?

      Originally posted by NinjaTrader_Jesse View Post
      This line says to Set the CurrentBar's value from Input or Input[0]. Value is the generic name for the index 0 Plot of this indicator.
      value from Input or Input[0] ? Which difference among them?

      Comment


        #4
        Hello,

        The Input and Input[0] are a Collection and an Index location of that collection.

        Input represents the DataSeries that you gave to the indicator, in the SMA(Close,12) call, we provide the SMA Close prices to use.

        In the code for the SMA, Input represents the passed series.

        Input[0] would be the amount of BarsAgo to get the price value for. The last bar on the chart is the CurrentBar or 0 bars ago.


        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello,
          The Input and Input[0] are a Collection and an Index location of that collection.
          That is means that here:
          Code:
          input[0]
          Input - Collection.
          [0] - an Index location of that collection/
          It is correct?
          If I'm right... Input it is Collection of which?
          And Input ... is Collection without any index?

          Originally posted by NinjaTrader_Jesse View Post
          Input[0] would be the amount of BarsAgo to get the price value for.
          Hm.. And why did not take the price value using Close, Hight or Low? Why in many indicator's using Input[0] ?

          Comment


            #6
            Hello,

            Input - Collection.
            [0] - an Index location of that collection/
            It is correct?
            If I'm right... Input it is Collection of which?
            And Input ... is Collection without any index?
            You are correct, Input is a collection or to be correct would be a DataSeries.
            This is a collection of whatever you provided to the indicator, lets look at the SMA again.
            If I call the SMA like the following:

            SMA(Close, 12)

            I provided the Close DataSeries to the SMA. Inside the SMA it uses Input because it expects a series to be provided to it so it can calculate values. I provided the Close in this example so Input would be Close.

            If I instead called SMA(High, 12), input is now the High series.

            This does have an index but not like a normal collection. The BarsAgo is used, looking at the statement:

            Close[0]

            This gets the last index of this collection (bar on the right of the chart or CurrentBar),

            the statement:

            Close[1]

            This would be the the last index of the collection minus 1. It is much easier to think of this in a BarsAgo value instead of a Index location, If i want the Current price I use [0], if I want a previous price i use [1] or [2] etc.. for how many bars ago you need a value from.


            Many indicators use Input instead of a specific series like Close because like the SMA you can tell the indicator what values you want it to calculate based off of.

            If the SMA was using Close instead of Input, you could only use the SMA for Close prices and that would be all, using Input the SMA can be used to apply a moving average to a number of different items.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello,
              You are correct, Input is a collection or to be correct would be a DataSeries.
              This is a collection of whatever you provided to the indicator, lets look at the SMA again.
              If I call the SMA like the following:
              Hm. I'd understand! It is, in some way, extern parameter... of indicator. If calling indicator like this:
              Code:
              SMA(Close, 12)
              In indicator passed element of dataseries - close.
              If calling indicator like this:
              Code:
              SMA(Low, 12)
              In indicator passed element of dataseries - Low.
              But it is not parameter exactly, so elements of dataseries passed to same indicators using interace( IDataSeries ).
              innit?
              Last edited by hozman; 06-17-2015, 10:40 AM.

              Comment


                #8
                Hello,

                I am sorry but I don't quite understand your question:

                In indicator passed element of dataseries - Low.
                But it is not parament exactly, so elements of dataseries passed to same indicators using interace( IDataSeries ).
                innit?
                Can you please re form this question and I will be happy to provide an answer.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Jesse View Post
                  Hello,

                  Input is the collection of Input IDataSeries a item has.
                  To ensure I am referring to the same as you are, this is the Input I am describing: http://www.ninjatrader.com/support/h.../nt7/input.htm

                  An example of this is the SMA(IDataSeries, Period)
                  The IDataSeries could be Close prices for example, so we have :

                  Code:
                  double someValue = SMA(Close, 12)[0];
                  the code inside SMA indicator:

                  Code:
                  Value.Set(Input[0]);
                  This line says to Set the CurrentBar's value from Input or Input[0]. Value is the generic name for the index 0 Plot of this indicator.

                  also
                  Code:
                  Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
                  else
                  Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
                  Is the calculation for the SMA using the input IDataSeries for its prices, this means that i could pass in Close, Open, High, Low, Volume or any IDataSeries value to the SMA indicator.

                  I look forward to being of further assistance.

                  Could you please explain to me what's wrong with this code:

                  if (CurrentBar == 0)
                  Value.Set(Input[0]);
                  else
                  {
                  double last = Value[1] * Math.Min(CurrentBar, Period);

                  if (CurrentBar >= Period)
                  Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
                  else
                  Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
                  }

                  If I'm not mistaken this is an original SMA indicator, right?

                  Comment


                    #10
                    Hello,

                    This does look like the SMA code, but I am unsure of what your question is related to this code.

                    Are you getting an error or is there syntax you do not understand? Can you please put this into the form of a question specific to what is happening or what you are seeing?

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Jesse View Post
                      Hello,

                      This does look like the SMA code, but I am unsure of what your question is related to this code.

                      Are you getting an error or is there syntax you do not understand? Can you please put this into the form of a question specific to what is happening or what you are seeing?

                      I look forward to being of further assistance.
                      There are FEW! logical mistakes in this short code.

                      Comment


                        #12
                        Originally posted by BankRobber View Post
                        There are FEW! logical mistakes in this short code.
                        Can you elaborate on this?

                        Comment


                          #13
                          Originally posted by Calonious View Post
                          Can you elaborate on this?
                          I will elaborate, but I'd love to get an answer from Ninja Speed Dream Team first ;-)))

                          Comment


                            #14
                            Originally posted by BankRobber View Post
                            There are FEW! logical mistakes in this short code.
                            There are no logicial errors. Maybe you simply do not understand it?

                            Comment


                              #15
                              Originally posted by Harry View Post
                              There are no logicial errors. Maybe you simply do not understand it?
                              Let's get the answer from the Ninja team first, then we'll see do i understand or not.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by mmenigma, Today, 02:22 PM
                              1 response
                              3 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by frankthearm, Today, 09:08 AM
                              9 responses
                              35 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by NRITV, Today, 01:15 PM
                              2 responses
                              9 views
                              0 likes
                              Last Post NRITV
                              by NRITV
                               
                              Started by maybeimnotrader, Yesterday, 05:46 PM
                              5 responses
                              26 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by quantismo, Yesterday, 05:13 PM
                              2 responses
                              21 views
                              0 likes
                              Last Post quantismo  
                              Working...
                              X