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

question about Series data

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

    question about Series data

    hi, i give you a questions about Series Data of ninjatrader8..

    SeriesData.Count is egual to Number of bar in a chart? then is egual to CurrentBar, is correct?

    i see code of nt8 @Swing.cs...look this piece of code:


    public int SwingLowBar(int barsAgo, int instance, int lookBackPeriod)
    {
    if (instance < 1)
    throw new Exception(string.Format(NinjaTrader.Custom.Resourc e.SwingSwingLowBarInstanceGreaterEqual, GetType().Name, instance));
    if (barsAgo < 0)
    throw new Exception(string.Format(NinjaTrader.Custom.Resourc e.SwingSwingLowBarBarsAgoGreaterEqual, GetType().Name, barsAgo));
    if (barsAgo >= Count)
    throw new Exception(string.Format(NinjaTrader.Custom.Resourc e.SwingSwingLowBarBarsAgoOutOfRange, GetType().Name, (Count - 1), barsAgo));

    Update();

    for (int idx=CurrentBar - barsAgo - Strength; idx >= CurrentBar - barsAgo - Strength - lookBackPeriod; idx--)
    {
    if (idx < 0)
    return -1;

    if (idx >= swingLowSwings.Count)
    continue;

    if (swingLowSwings.GetValueAt(idx).Equals(0.0))
    continue;

    if (instance == 1) // 1-based, < to be save
    return CurrentBar - idx;

    instance--;
    }

    return -1;
    }
    i see that:
    if (idx >= swingLowSwings.Count)
    continue;

    how it's possible that idx >=swingLowSwings.Count ?
    (swingLowSwings is series Data...then is egual to CurrentBar..


    Are correct? ..and in

    for (int idx=CurrentBar - barsAgo - Strength; idx >= CurrentBar - barsAgo - Strength - lookBackPeriod; idx--)

    idx can to be only lower of CurrentBar


    Then why there is in a code :
    if (idx >= swingLowSwings.Count)
    continue;

    i don't understand this :\

    #2
    Hello turbofib, and thank you for your question.

    While debugging user code is beyond the scope of the support we may provide, I did notice that swingLowSwings.Count is not initialized inside this method, and that its value is not checked in the beginning of this method where other values are checked. The most likely reason for this code, then, is to ensure that this method does nothing in the case where swingLowSwings is uninitialized. Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by hazylizard, Today, 08:38 AM
    2 responses
    8 views
    0 likes
    Last Post hazylizard  
    Started by geddyisodin, Today, 05:20 AM
    2 responses
    18 views
    0 likes
    Last Post geddyisodin  
    Started by Max238, Today, 01:28 AM
    5 responses
    47 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by giulyko00, Yesterday, 12:03 PM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by habeebft, Today, 07:27 AM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_ChristopherS  
    Working...
    X