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

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 usjavaburn, Today, 12:59 AM
              0 responses
              2 views
              0 likes
              Last Post usjavaburn  
              Started by heatherjmarshalls, Today, 12:56 AM
              0 responses
              2 views
              0 likes
              Last Post heatherjmarshalls  
              Started by Nicholewatkinsi, Yesterday, 10:53 PM
              0 responses
              6 views
              0 likes
              Last Post Nicholewatkinsi  
              Started by dward123, 01-02-2024, 09:59 PM
              4 responses
              176 views
              0 likes
              Last Post Lancer
              by Lancer
               
              Started by ETFVoyageur, Yesterday, 04:00 PM
              2 responses
              19 views
              0 likes
              Last Post ETFVoyageur  
              Working...
              X