Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Haiasi, Today, 06:53 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ScottWalsh, Today, 06:52 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ScottW, Today, 06:09 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ftsc2022, 10-25-2022, 12:03 PM
        5 responses
        256 views
        0 likes
        Last Post KeyonMatthews  
        Started by Board game geek, 10-29-2023, 12:00 PM
        14 responses
        244 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Working...
        X