Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does optimiztion work wih custom collection with user defined values at run time?

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

    Does optimiztion work wih custom collection with user defined values at run time?

    Hi Ninjatrader,

    I have created a collection / list with user defined values at run time for my strategy following use case 5 in this example: https://ninjatrader.com/support/foru...havior?t=97919

    When I try to run the optimization in the strategy analyzer I see that such collection does not offer a range of values for the variables on the list. Is there a way to support optimization?

    Thanks!

    #2
    Hello xbionicx,

    The strategy analyzer is able to optimize integers, doubles, bools, and enums.

    Your script would need to optimize over an enum and select each value from the collection.

    Any custom variables should be initialized / re-initialized in OnStateChange() when State is State.DataLoaded.

    Below is a link to the help guide.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thanks for your reply.

      I don't understand your answer. Why do you talk about enums? If you take a look at use case 5 there are no enums but a NinjaTrader.Gui.Tools.CollectionEditor. How can I hook up my own code so that the optimizer also optimizes the Collection?

      Comment


        #4
        Hello xbionicx,

        The Strategy Analyzer is not designed to optimize over collection objects.

        Instead you would need a different input that is optimized used as an index for the collection.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks again Chelsea.

          I use the collection to store the profit and stop configuration for each contract. The user of the strategy can dynamically decide how many contracts he/she wants for the strategy and the profit/stop configuration for each contract. Of course, I would like to optimize based on the profit/stop configuration of each contract.

          Other than fixing the number of contracts and creating fix profit/stop configuration input variables for each contract, is there a better way to design this?

          Thanks for your time

          Comment


            #6
            Hello xbionicx,

            If you would like to optimize inputs, you will need to design the script knowing that only integers, doubles, bools, and enums can be optimized over.

            With collections, as the collection cannot be optimized over, an index could be optimized instead and this index used with the collection or array.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks Chelsea. Clear. I appreciate your help

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              52 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              130 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              70 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              43 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              48 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X