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 PhillT, 04-19-2024, 02:16 PM
    4 responses
    34 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Started by ageeholdings, 05-01-2024, 05:22 AM
    5 responses
    37 views
    0 likes
    Last Post ageeholdings  
    Started by reynoldsn, Today, 02:34 PM
    0 responses
    13 views
    0 likes
    Last Post reynoldsn  
    Started by nightstalker, Today, 02:05 PM
    0 responses
    19 views
    0 likes
    Last Post nightstalker  
    Started by llanqui, Yesterday, 09:59 AM
    8 responses
    32 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Working...
    X