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 Taddypole, 04-26-2024, 02:47 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Eduardo  
        Started by futtrader, 04-21-2024, 01:50 AM
        6 responses
        58 views
        0 likes
        Last Post futtrader  
        Started by sgordet, Today, 11:48 AM
        0 responses
        4 views
        0 likes
        Last Post sgordet
        by sgordet
         
        Started by Trader146, Today, 11:41 AM
        0 responses
        5 views
        0 likes
        Last Post Trader146  
        Started by jpapa, 04-23-2024, 07:22 AM
        2 responses
        22 views
        0 likes
        Last Post rene69851  
        Working...
        X