Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multiple data series bar update ?

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

    multiple data series bar update ?

    so i have an indicator with multiple data series, i have the chart data series, and I add in 2 larger candle data series in the indicator.

    I am trying to write code on the bar update that will only be hit when the larger, indicator added bars close, not the smaller candle from the chart. Is there any way to do this?

    #2
    Hello ErikY,

    Thank you for your reply.

    Yes, you can check the BarsInProgress value of the series that is currently iterating through OnBarUpdate and only execute code if it is currently on a specific series.

    For example, if we have a primary data series of one minute, and we add two secondary series, a 5 and a 15 minute like below:

    Code:
    AddDataSeries(BarsPeriodType.Minute, 5);
    AddDataSeries(BarsPeriodType.Minute, 15);
    The primary 1 minute series will have a BarsInProgress of 0, the first added data series (5 minute) will have a BarsInProgress value of 1, and the second added data series will have a BarsInProgress value of 2. So, within OnBarUpdate we can use those to specify when to execute certain code:

    Code:
    //within OnBarUpdate
    
    if (BarsInProgress == 0)
    {
    // code in here will only be executed when the 1 minute series is processing in OnBarUpdate
    }
    else if (BarsInProgress == 1)
    {
    // code in here will only be executed when the 5 minute series is processing
    }
    else if (BarsInProgress == 2)
    {
    // code in here will only be executed when the 15 minute series is processing
    }
    Please see this example from our help guide of a strategy that implements this kind of logic to enter on one series and exit on another:



    Please let us know if we may be of further assistance to you.

    Comment


      #3
      awesome, thanks much!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      608 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      355 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      560 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      561 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X