• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ksarin, Today, 12:39 PM
    3 responses
    9 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Started by ttodua, Today, 12:03 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by tomtr27, Today, 11:35 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Uregon, Today, 07:30 AM
    2 responses
    12 views
    0 likes
    Last Post bltdavid  
    Started by Induna, 02-20-2020, 05:38 AM
    4 responses
    26 views
    0 likes
    Last Post NinjaTrader_Kate  
    Working...
    X