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

Indicator for 2 shares

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

    Indicator for 2 shares

    Hi!

    I want to create an indicator for 2 different shares and I want to implement this indicator in a chart of another share.

    Is this possible somehow?

    Thank you!

    plizer

    #2
    Hello plizer,

    Thank you for your note.

    If you plan to do this in code you can do so by adding the two shares to your indicator code and then use their values to set the plots. Then add the indicator to your third share's chart.

    For information on multiple series in your script please visit the following link: http://ninjatrader.com/support/helpG...nstruments.htm

    Please let me know if you have any questions.

    Comment


      #3
      Does this technique also have the possibility to add about 100 stocks? Or is it limited somehow?

      Comment


        #4
        Hello plizer,

        Thank you for your response.

        You can add as many instruments as needed, but keep in mind the data provider you connect to will likely have a limit on the number of instruments that can request data at one time. In most cases this is 100 instruments.

        Comment


          #5
          Thank you for the answer!

          I read alll about BarsArray now and I couldnt find some of the needed data. In the help guide are just examples to get an indicator of a BarArray, like this:
          if (CCI(20)[0] > 200 && CCI(BarsArray[1], 20)[0] > 200
          && CCI(BarsArray[2], 20)[0] > 200)

          I thought the BarArray includes the different stocks I added with all information. But I cant get the information I need.

          For example: I add 10 stocks to the list. Then the primary data is BarsArray[0], the first added stock is BarsArray[1] and so on...

          But I cant get the last Close (or High or Low) with BarsArray[1].Close[0] or the second Close with BarsArray[1].Close[1]. How can I get those information?

          I can get the CurrentAsk with BarArray[1].CurrentAsk, but I want to get all CurrentAsk in the past.

          Maybe I just dont understand the system correctly?

          Comment


            #6
            Hello plizer,

            Thank you for your response.

            You would use Closes[barsInProgress index][barsAgo index]. So the secondary bar series close before the current bar would be Closes[1][1].

            Please visit the following link for more information: http://ninjatrader.com/support/helpG...nt7/closes.htm

            For information on multiple series in your script please visit the following link: http://ninjatrader.com/support/helpG...nstruments.htm

            Please let me know if you have any questions.

            Comment


              #7
              Thank you! Sounds logical!

              Comment


                #8
                I have another question. Thank you for your time in advance.

                Besides Closes[][] I need the same for BID and ASK, but I couldnt find it in the help.

                I want to work with every stock everytime when something has changed: like the last tick, the current BID and the current ASK and the also if the volume of BID or ASK and CLOSE/last changed!

                Comment


                  #9
                  Hello plizer,

                  Thank you for your post.

                  Current Ask, Bi, Ask Volume, and Bid Volume methods (ex: GetCurrentBid()) all can have the barsInProgress index passed to them to call the various bar series inputs.

                  Please review the information under Data in the Help Guide at the following link: http://ninjatrader.com/support/helpG...currentask.htm

                  Comment


                    #10
                    I found GetCurrentAsk() before.

                    But I dont know where I enter the data of the BarsArray. Do you have an example? How can i get the second last BID of the second stock in my list?

                    Comment


                      #11
                      Hello plizer,

                      Thank you for your response.

                      Let's say we want the second bar series bid: GetCurrentBid(1);

                      If we wanted a previous bar's bid or ask value we would need to add the Bid or Ask market data type to the script in Initialize() and then call it as you would the other added series.

                      For example in Initialize():
                      Code:
                      Add("AAPL", PeriodType.Minute, 1, MarketDataType.Bid);
                      Please make sure to review the information at the following link: http://ninjatrader.com/support/helpG...nstruments.htm

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by ZenCortexCLICK, Today, 04:58 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post ZenCortexCLICK  
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      172 responses
                      2,280 views
                      0 likes
                      Last Post sidlercom80  
                      Started by Irukandji, Yesterday, 02:53 AM
                      2 responses
                      17 views
                      0 likes
                      Last Post Irukandji  
                      Started by adeelshahzad, Today, 03:54 AM
                      0 responses
                      4 views
                      0 likes
                      Last Post adeelshahzad  
                      Started by Barry Milan, Yesterday, 10:35 PM
                      3 responses
                      13 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Working...
                      X