• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 dkbyond, Today, 04:11 PM
        0 responses
        1 view
        0 likes
        Last Post dkbyond
        by dkbyond
         
        Started by markus3500, Today, 03:29 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by bohenriksen, Today, 04:00 AM
        1 response
        20 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by brett0, Today, 12:33 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Melissa  
        Started by lordvader34, Today, 11:12 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Working...
        X