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


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

    See here.



    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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      162 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      313 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X