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