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

Print/Get Strategy Properties

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

    Print/Get Strategy Properties

    I have a large number of properties, and would like to print or save a copy of the values currently assigned. I am looking for a way to get the property collection for the strategy (read-only is fine). From there should be easy enough to sort thru, but I am not seeing a built-in way to get the property collection. Can this be done? Can you provide an example of how to do?


    #2
    use print("Text Here "); and check output window

    Comment


      #3
      Hello aslane,

      It would be better to print the exact properties you are looking for.

      However, you may be able to loop through the PropertyDescriptorCollection.
      Below is a link to a reference sample that shows how to use this collection.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Yes, I have seen that sample, but how do you get the PropertyDescriptorCollection from within a strategy (i.e. from OnStateChange). Or how to get a ref to the TypeConverter for the strategy? Once you have that the rest of the sample becomes pertinent.

        Normally, I would just print them out like you say, but I have a framework that has a rather large number, and it continues to change so having a routine that just works by iterating the collection would be nice.

        Comment


          #5
          Hello aslane,

          The custom converter can be used in a strategy.

          I guess if you wanted to access this from OnStateChange instead of where it is available from the converter you could copy the collection to another variable and loop through that in OnStateChange if its not null or empty..

          This would be outside of what is supported by NinjaTrader and would require a custom solution.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Ok, I've been able to find and sort thru which properties should be displayed. The only piece I am missing is finding the Category Order Attributes attached to the strat/ind (i.e. [Gui.CategoryOrder("Entry", 800010)] placed above class), so I can properly sort them on output. Can you provide a little hint on how to get that attribute collection?

            Comment


              #7
              Hello aslane,

              Getting the Category Order attributes programmatically would be outside of what is supported by NinjaTrader Support and I do not have further information about that.

              This thread will remain open for any community members that may know how to find this information.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks, found them, were sitting further up in the inheritance tree.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by agclub, 04-21-2024, 08:57 PM
                4 responses
                18 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by Irukandji, Today, 04:58 AM
                0 responses
                3 views
                0 likes
                Last Post Irukandji  
                Started by fitspressoburnfat, Today, 04:25 AM
                0 responses
                2 views
                0 likes
                Last Post fitspressoburnfat  
                Started by Skifree, Today, 03:41 AM
                1 response
                4 views
                0 likes
                Last Post Skifree
                by Skifree
                 
                Started by usazencort, Today, 01:16 AM
                0 responses
                1 view
                0 likes
                Last Post usazencort  
                Working...
                X