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

input as array

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

    input as array

    Hello

    I'm doing a strategy which needs 64 groups of 4 inputs, so I wanna put them in 4 arrays. My doubt is how could I declare the array so that I can optimize them.

    Thanks four your help

    #2
    Hello etruria,

    Thank you for the question.

    For a property to be optimized, it would need the NinjaScriptAttribute tag and also be a type that can be optimized. You can find an example here:


    If you want groups, that is easily configurable with the Display attribute and the GroupName. You could place the same group over 4 different properties and they would become the same group in the user interface. https://ninjatrader.com/support/help...yattribute.htm

    You noted you want to use 4 arrays, but you also noted you have 64 input groups, are you intending to further group the 4 inputs from each of the 64 groups into the 4 other arrays you mentioned? Can you provide more detail on how you want the optimizer to iterate over the groups of properties in more detail?

    The optimizer can only optimize ranges of values over individual properties with the NinjaScriptAttribute. If you need to optimize a whole group at once, like the array you are speaking of you may need to handle that with logic in your script. I would need more details to provide more relevant help in this case.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Sorry, there are 4 groups of 64 inputs, that groups are loss stops and gain stop and two more things

      Comment


        #4
        Hello,

        Thank you for the reply.

        In that case, you can do that with just the display attribute and GroupName property. The help guide has an example of one property, you would replicate this for all properties and make the group name reflect the group the property should be in.

        The NinjaScriptAttribute would also be used so the property shows up in the optimizer. Once you add those two attributes, you would get optimizable properties in various groups of your choosing.

        Code:
        [NinjaScriptProperty]
        [Display(Name="Target1", Order=1, GroupName="FirstTargets")]
        public int Target1
        { get; set; }
        
        [NinjaScriptProperty]
        [Display(Name="Target2", Order=2, GroupName="FirstTargets")]
        public int Target2
        { get; set; }
        
        [NinjaScriptProperty]
        [Display(Name="Target3", Order=3, GroupName="FirstTargets")]
        public int Target3
        { get; set; }
        
        [NinjaScriptProperty]
        [Display(Name="Target4", Order=4, GroupName="FirstTargets")]
        public int Target4
        { get; set; }

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I think its late but maybe the Series type of NinjaScriptProperty would works for your case:


          Code:
                  
                  [Browsable(false)]
                  [XmlIgnore]
                  public Series<int> yourArray
                  {
                      get
                      {return Values[0];}
                  }

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cre8able, 04-17-2024, 04:16 PM
          7 responses
          61 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Aviram Y, 08-09-2023, 09:04 AM
          11 responses
          299 views
          0 likes
          Last Post arjandezeeuw  
          Started by Christopher Leggit, 02-15-2024, 09:00 AM
          3 responses
          45 views
          0 likes
          Last Post rdtdale
          by rdtdale
           
          Started by DavidHP, Today, 07:56 AM
          0 responses
          2 views
          0 likes
          Last Post DavidHP
          by DavidHP
           
          Started by jpapa, Today, 07:22 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X