Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hard wire a symbol into an indicator

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

    Hard wire a symbol into an indicator

    I am trying to figure out how to added another instrument into an indicator.

    For example, My main symbol on the chart is the S&P 500 emini 5 minute and is the only chart I want to see. However my indicator is based of the emini YM on a 2 minute. So the question is:

    How do I reference OHLC on the YM on a 2 minute time frame inside my idicator? what should it look like?

    I understand this:

    Add(Symbol2.ToUpper(), BarsPeriod.Id, BarsPeriod.Value);

    but that is only if it is added to the chart to see visually. I don't want to see it, just use its values in the calculation of my indicator.

    thanks
    Last edited by velocity; 11-21-2009, 12:48 PM.

    #2
    The Add() statement inside an indicator doesn't add it to the chart, it adds a bar series for use by the indicator. It should be all you need; if it's the only thing you add, it will be bar series 1.

    I prefer to pass the symbol as a parameter, but if you want to hardwire it, I think this will work:

    Add("YM 12-09", PeriodType.Minute, 2); // 2 minute YM series

    To reference it inside OnBarUpdate():

    if (BarsInProgress == 0) // Primary Instrument
    {
    // Close[0], Open[0], High[0] etc. refers to primary instrument in this context
    // Closes[1][0], Opens[1][0], Highs[1][0], etc always refers to seconday instrument
    }

    if (BarsInProgress == 1) // Secondary Instrument
    {
    // Close[0], Open[0], High[0] etc. refers to secondary instrument in this context
    // Closes[0][0], Opens[0][0], Highs[0][0], etc always refers to primary instrument
    }
    Last edited by kdoren; 11-21-2009, 02:34 PM.

    Comment


      #3
      Thank you. I will experiment with your suggestion.


      Ninja Support,

      Is there documentation on this anywhere?


      thanks

      Comment


        #4
        NT7 docs still are in the making. Add() on indicators works like Add() on strategies with NT6.5. Please see docs there.

        Comment


          #5
          Dierk,

          You have mentioned that in NT7 we can use "Add" method in indicator as it used to be in Strategy scripts.
          I was trying to add indicator on indicator. Ideally, it supposed to be something like this in Initialize method of indicator:

          Add( SMA(50 ) );

          However, there is no overloaded method with parameter as Indicator.

          How would you recommend to add Indicator to an Indicator.
          You do this somehow from wizard when we add indicator as input series. Moreover, in wizard we are able to add indicator based on other instrument bars. How it can be done from the script ?

          Comment


            #6
            That is not what I said. I said, you could use Add() in the scope of the original post, which was adding series not indicators, in indicators like in strategies.

            You can not Add() an indicator to an indicator.

            Comment


              #7
              Hi Dierk,

              Thank you for your answer.

              May I ask you to answer to the second part of my question:

              Is it possbile to add bars to the indicator that are a product of some other indicator as it is done in wizard, when we are able to add Input data series as Indicator on some other instrument ?
              I guessing, may be any special syntax of Instrument string in the Add() method or something. Do you have this feature ?

              Comment


                #8
                There is a misunderstanding on the Add() method.

                You can do something like SMA(EMA(50))[0] in your OnBarUpdate() method. There is no need for an Add() method whatsoever. I suggest checking out the NT standard indicators to understand who indicators would use indicators.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                602 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                347 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
                559 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                559 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X