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 robforee2, Today, 05:07 PM
      0 responses
      1 view
      0 likes
      Last Post robforee2  
      Started by blar58, Today, 03:16 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Melissa  
      Started by alcorr247, Today, 02:52 PM
      2 responses
      7 views
      0 likes
      Last Post robforee2  
      Started by Radano, Today, 02:30 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by DrummerBoy, Today, 01:34 PM
      3 responses
      31 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Working...
      X