Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

4 field data set

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

    4 field data set

    I've written script that produces four data elements (eg, bar number, time, price, volume).
    Depending on trading conditions, one or more of these can be produced each second or few minutes. I'd like to store all of these for access by other blocks elsewhere in the script. Since these elements are different types, an array isn't possible. Since I need four fields, List and Dictionary aren't possible.

    Yes, I could do something like SortDictionary < int, List <DateTime, List <double, double>>>, but that seems kluggie because two new lists have to be created for each new row of SortDictionary. And, each of those lists has just one row, so not a good use of List.

    And, no, DataSeries doesn't work either because NT puts in phantom values if there is no value for that particular bar of the primary series.

    So, any suggestion as to how this might be accomplished ?

    #2
    Hello spottysallrite,

    Thank you for the post.

    In this case, you likely want a Custom Object which is a class you create.

    You can use the Level II sample we provide as that has an example of a C# class.
    The "LadderRow" class in the file is the custom object or C# class: https://ninjatrader.com/support/help...to_output_.htm

    This class is also used in a List in the example so this could serve both the purpose of making a custom object for your data and if needed how to use it with a collection.

    If you only have one row, you may just need a variable for the custom object to store the various values in. If you needed more than one row, you could use a List with your object as the List<T> .


    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    566 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X