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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    152 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    87 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    131 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    127 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    106 views
    0 likes
    Last Post CarlTrading  
    Working...
    X