• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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:
    https://ninjatrader.com/support/help...yattribute.htm

    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 indy73, Today, 04:42 PM
          0 responses
          10 views
          0 likes
          Last Post indy73
          by indy73
           
          Started by Italianforex, Today, 06:20 AM
          2 responses
          12 views
          0 likes
          Last Post gplatis
          by gplatis
           
          Started by alextrd, Today, 01:51 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_JoshG  
          Started by Boonfly8, Today, 12:10 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by NinjaTrader_PaulH, Today, 11:24 AM
          0 responses
          7 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Working...
          X