Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator calculating two data series

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

    Indicator calculating two data series

    Hi,

    just wondering how to create a indicator which would deal with two data series?
    For instance, i would like to calculate the difference of S&P future 062011 and 092011 on every incomming tick.

    I havent found how to adress the second data serie in a code. Loading one data serie into indicator can be easily done. But how to address the another data serie?

    I am looking for a command something like:

    S&P future 062011.Last[0] - S&P future 092011.Last[0].

    Thanks a lof for your help!!
    m. g.

    #2
    Welcome to our forums here - you would want to Add() your needed series first and then reference either via Closes[][] or the BarsArray properties your input series -





    Here's more background info on the MultiSeries framework in NinjaScript -

    Comment


      #3
      Thanks a lot Bertrand.

      I will read through the suggested links!
      m.g.

      Comment


        #4
        FYI if you just want to plot the difference, in the NT7 indicators section I have an indicator called "Spread" that will do that, and I also have a new indicator called "Index" that will also do that and more.

        http://www.ninjatrader.com/support/f...d=4&linkid=367

        http://www.ninjatrader.com/support/f...d=4&linkid=456

        Comment


          #5
          Originally posted by malej.gregy View Post
          Hi,

          just wondering how to create a indicator which would deal with two data series?
          For instance, i would like to calculate the difference of S&P future 062011 and 092011 on every incomming tick.

          I havent found how to adress the second data serie in a code. Loading one data serie into indicator can be easily done. But how to address the another data serie?

          I am looking for a command something like:

          S&P future 062011.Last[0] - S&P future 092011.Last[0].

          Thanks a lof for your help!!
          m. g.
          And I am just wondering, I have an indicator premium calculating the difference between cash index and its future contract. it is supported by my data feed (IQ Feed) however I dont seem to manage to load it into Ninja Trader Is it supported by NT?

          Thanks for help.

          Comment


            #6
            Hello, would it also work with cash index and its future contract?
            Thanks a lot!


            Originally posted by kdoren View Post
            FYI if you just want to plot the difference, in the NT7 indicators section I have an indicator called "Spread" that will do that, and I also have a new indicator called "Index" that will also do that and more.



            http://www.ninjatrader.com/support/f...d=4&linkid=456

            Comment


              #7
              Hello malej.gregy,

              If you receive data for this instrument in IQFeed, you should be able to add it to NinjaTrader.


              NinjaTrader comes pre-loaded with the most commonly traded instruments however, you may find the need to add an additional instrument. Please follow the instructions below to add an instrument in the Instrument Manager.

              * From the NinjaTrader Control Center window select the menu Tools > Instrument Manager
              * Press the "New" button
              * *Enter in instrument specific information and select the appropriate exchange (add Default exchange for equities in addition to the actual exchange)
              * Fill in any relevant information under the "Misc" tab such as symbol mapping for your target connectivty provider
              * Press the "OK" button
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Yes, but the symbols must be properly specified. If by cash index you mean the spot price, you would enter "$EURUSD" as the parameter for the indicator, and in the NT7 Instrument Manager under the name "EURUSD" you would enter the symbol "EURUSD.FXCM" in the symbol map for IQFeed (assuming you either subscribe to realtime Forex data from IQFeed or are testing with delayed data).

                For the Index indicator, you could enter the parameters:
                SymbolList: $EURUSD,6E 06-11
                WeightList: 1,-1

                This would plot the spread between the spot and futures price.
                You could also use the Spread indicator (set "UseMultiplier to "false"), but I recommend Index because it has better facilities for handling missing input data (you can set it to produce "no output" if an input is missing, so it won't plot a misleading output when the futures markets aren't trading). You can also use the Index indicator on a chart of any symbol, it doesn't have to be a chart of a symbol you're plotting the spread of.

                -Kevin

                Comment


                  #9
                  You could also use my indicator http://www.ninjatrader.com/support/f...ad.php?t=38011 which is even more flexible than Kdoren's indicators (with due respect to his work). In your case you would input expression as follows: 'ES 06-11' - 'ES 09-11'. Technically, you can input any meaningful mathematical expression. You can plot expressions as candlestick, line, HiLo, OHLC or box chart.

                  Comment


                    #10
                    Originally posted by UltimateIndicator View Post
                    You could also use my indicator http://www.ninjatrader.com/support/f...ad.php?t=38011 which is even more flexible than Kdoren's indicators (with due respect to his work). In your case you would input expression as follows: 'ES 06-11' - 'ES 09-11'. Technically, you can input any meaningful mathematical expression. You can plot expressions as candlestick, line, HiLo, OHLC or box chart.
                    Is that a DLL, or is it .cs ?

                    Comment


                      #11
                      Originally posted by NinjaTrader_RyanM View Post
                      Hello malej.gregy,

                      If you receive data for this instrument in IQFeed, you should be able to add it to NinjaTrader.


                      NinjaTrader comes pre-loaded with the most commonly traded instruments however, you may find the need to add an additional instrument. Please follow the instructions below to add an instrument in the Instrument Manager.

                      * From the NinjaTrader Control Center window select the menu Tools > Instrument Manager
                      * Press the "New" button
                      * *Enter in instrument specific information and select the appropriate exchange (add Default exchange for equities in addition to the actual exchange)
                      * Fill in any relevant information under the "Misc" tab such as symbol mapping for your target connectivty provider
                      * Press the "OK" button
                      Hi Ryan, sorry for another question. How should I choose an exchange for an indicator which is automatically calculated by IQ Feed? Lets say that I want to import the IQ Feed symbol PRSP.Z. Could you please help me with this?

                      Thanks for your help

                      Comment


                        #12
                        Hello malej.gregy,

                        These indicators will run from the exchange the instrument is charting on. With IQFeed, you typically do not need to assign another exchange and the 'Default' exchange will work for data.
                        MatthewNinjaTrader Product Management

                        Comment


                          #13
                          I was using your spread indicator some time back and it seemed to be working fine. However, I had to reinstall NinjaTrader last week, and had quite a lot of trouble, (charts not showing, etc.) and after working with support they told me that the problem was with the spread indicator; not coded properly. After deleting it, my charting problems seemed to be ok, but I still want to be able to plot spreads. Could you suggest what I might do to facilitate that. And if I try to download the one you refer to here I'm not sure how to import it into nt. Any help would be greatly appreciated.

                          Comment


                            #14
                            I suggest you re-download the "Spread" indicator; I updated the file a few months ago to fix a problem which was triggered if you were using Renko bars in any of your charts. Other than that I'm not aware of any problems, and it works fine on my system.

                            You could also try my "Index" indicator, which can also be used to plot spreads.

                            Inidicators are easily imported using File -> Utilities -> Import NinjaScript

                            Comment


                              #15
                              Question to both of you - KDoren and Ultimate - why is that the spreads cannot be built from historical data. I can plot charts of both symbols but cant calculate difference between them? why? I dont want to keep my PC on for weeks to collect data which I might not need at all..

                              Can it be fixed please?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              581 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              338 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              554 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              552 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X