Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Instrument Indicator

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

    Multi Instrument Indicator

    I want to call the High and Low values of indicator XYZ of instrument ABC.

    Protected override void Initialize()
    {
    Add("ABC",PeriodType.Minute,1);
    }

    Protected override void OnBarUpdate()
    {
    double XYZHigh = XYZ().TheHigh[0];
    double XYZLow = XYZ().TheLow[0];
    }

    How do I reference ABC in the above OnBarUpdate for this to work?
    Thanks in advance

    #2
    Originally posted by 2Look4me View Post
    I want to call the High and Low values of indicator XYZ of instrument ABC.

    Protected override void Initialize()
    {
    Add("ABC",PeriodType.Minute,1);
    }

    Protected override void OnBarUpdate()
    {
    double XYZHigh = XYZ().TheHigh[0];
    double XYZLow = XYZ().TheLow[0];
    }

    How do I reference ABC in the above OnBarUpdate for this to work?
    Thanks in advance
    I believe this is what your looking for
    http://ninjatrader.com/support/helpG...nt7/?highs.htm

    I just realised it was the indicator val you need not the high....

    See here.

    http://ninjatrader.com/support/helpGuides/nt7/?add3.htm

    if you call your indicator as per normal but only in the correct BarsInProgress index then it will work.

    I dont know if you can call an indicator from the added timeframe directly without being in the correct barsinprogress but i would be interested to hear if there is a way.

    Here is an example

    protected override void Initialize()
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    Add("$AUDUSD", PeriodType.Minute, 5);
    Add("$EURUSD", PeriodType.Minute, 5);
    }


    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1)Print ("Atr for AUDUSD 5 min = "+ATR(14)[0]);
    if (BarsInProgress == 2)Print ("Atr for EURUSD 5 min = "+ATR(14)[0]);

    }
    Last edited by marty087; 10-13-2015, 05:14 AM.

    Comment


      #3
      Hello 2Look4me,

      Thank you for your post.

      To reference the added bar series add BarsArray[1] to the indicator. For example:
      Code:
      XYZ(BarsArray[1]).TheHigh[0]

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Danila, Today, 11:08 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by dbida001, Today, 10:31 AM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by Brandon9821, Today, 08:27 AM
      3 responses
      23 views
      0 likes
      Last Post Brandon9821  
      Started by tonynt, Today, 10:00 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by Peppo, Today, 08:47 AM
      2 responses
      14 views
      0 likes
      Last Post Peppo
      by Peppo
       
      Working...
      X