Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Questions concerning "count & index"

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

    Questions concerning "count & index"

    I have questions about "count & index" that I could use some help on.

    "Code snippets" has the following...


    for (int index = 0; index < count; index++)


    My Questions

    1.) Does (index = 0) equal the most recent bar closed?

    2.) If count = 20, does the above statement retrieve the last 20 index values?

    3.) If "count" equals number of bars, what does "index" represent?


    The only info I could find that may relate to any of these was in NT0019.

    NT0019
    The following NT0019 error code information is provided within the context of NinjaScript. The examples provided is only a subset of potential problems that this error code may reflect. In any case, the examples below provide a reference of coding flaw possibilities.


    Error Code Explanation
    This error can happen when a DataSeries is compared to another object via the use of relational operators. Relational operators (==, <, >, <=, >=) can be used to compare the values of the DataSeries but not the DataSeries object itself.


    To fix this error ensure that you are actually comparing the values of the DataSeries to another object. You can do this by adding the index value to the DataSeries call. The index value is on a zero-based referencing system. [0] references the latest bar while [1] references one bar ago and [2] references two bars ago.

    If I could get answers to these 3 questions, it would help alot.

    Thanks,

    RJay
    Last edited by RJay; 07-10-2008, 12:23 PM.
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    #2
    This is just a template for a for loop. Index and count are just variables that represent the iteration of the loop and the number of iterations. They can mean anything.
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X