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 Waxavi, Today, 02:10 AM
    0 responses
    6 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by TradeForge, Today, 02:09 AM
    0 responses
    11 views
    0 likes
    Last Post TradeForge  
    Started by Waxavi, Today, 02:00 AM
    0 responses
    2 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by elirion, Today, 01:36 AM
    0 responses
    4 views
    0 likes
    Last Post elirion
    by elirion
     
    Started by gentlebenthebear, Today, 01:30 AM
    0 responses
    5 views
    0 likes
    Last Post gentlebenthebear  
    Working...
    X