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 rtwave, 04-12-2024, 09:30 AM
    4 responses
    29 views
    0 likes
    Last Post rtwave
    by rtwave
     
    Started by yertle, Yesterday, 08:38 AM
    7 responses
    28 views
    0 likes
    Last Post yertle
    by yertle
     
    Started by bmartz, 03-12-2024, 06:12 AM
    2 responses
    21 views
    0 likes
    Last Post bmartz
    by bmartz
     
    Started by funk10101, Today, 12:02 AM
    0 responses
    6 views
    0 likes
    Last Post funk10101  
    Started by gravdigaz6, Yesterday, 11:40 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X