Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

dataseries on multi time frame strategy

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

    dataseries on multi time frame strategy

    Simple question, created a dataseries 'swingLows' in a strategy being run on a 2min chart. The strategy adds a tick series as well.

    How many values will swingLows contain? As many as the primary series?

    So, if a portion of the code says something like:

    Code:
    if (BarsInProgress == 0)
    {
        if (Lows[0][3] >= Lows[0][2] && Lows[0][2] <  Lows[0][1])
        {
              swingLows.Set(Lows[0][2];
         }
    }
    
    if (BarsInProgress == 1) //referring to the added tick series
    {
        for (int i = 0; i < swingLows.Count; i++) 
        {
             if (Opens[1][1] >  swingLows[i] && Opens[1][0] <= swingLows[i])
             {
                .....
              }
         }
    }
    Can I feel confident that swingLows[3], no matter what BarsInProgress section it's being referred to in, will always be referring to the 3rd bar ago on the 2 min chart?

    Thanks

    #2
    BarsInProgress only checks which Bar object is calling OnBarUpdate. This means that regardless of where you have called swingLows[3], it will be referring the primary series you had Set() in the data series.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Okay, so if there are only 10 bars on the primary (2 min) chart, and I only use swingLows.Set() in a BarsInProgress == 0 area of the code, then there will only be 10 values in the swingLows DataSeries... have I got it right?

      Comment


        #4
        Yes, if you're counting from the current bar on the chart.

        If you were counting from Lows[0][2], there would only be 8 out of 10 bars in the series.
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X