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

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 Barry Milan, Yesterday, 10:35 PM
    5 responses
    16 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by DanielSanMartin, Yesterday, 02:37 PM
    2 responses
    13 views
    0 likes
    Last Post DanielSanMartin  
    Started by DJ888, 04-16-2024, 06:09 PM
    4 responses
    12 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by terofs, Today, 04:18 PM
    0 responses
    11 views
    0 likes
    Last Post terofs
    by terofs
     
    Started by nandhumca, Today, 03:41 PM
    0 responses
    8 views
    0 likes
    Last Post nandhumca  
    Working...
    X