Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to add a specific parameter to Strategy

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

    #16
    Hi Jesse

    Thank you for your reply.

    Is there a specific section in the indicator that I should be looking for that deals exclusively with making parameters available when setting up conditions in Strategy Builder?

    Comment


      #17
      Hello notenufftime,

      Typically public variables (inputs) are added at the bottom of the file and sometimes in a region named region Properties, but these can be declared anywhere in the scope of the class and don't have to be in a region.

      As long as the public variable is using the NinjaScriptProperty attribute and has an auto property get and set it should be appearing as an input in the UI for the Strategy Builder or Indicators window.

      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Thank you ChelseaB

        I dug through it and see no differences between the property that is available and the one that isn't. I'm not a programmer but want to be, until I start doing it haha.
        I will continue to see what I can come up with and update this if I have some success.

        Comment


          #19
          Originally posted by notenufftime View Post

          I apologize for the necromancy of this old thread, but I am having the same dilemma.

          jpeep never resolved this or at least didn't share the outcome.

          I think jpeep just didn't explain that he wanted to expose other variables of the same indicator for use by strategy builder.

          Let say that MACD has three variables that you could get/set in properties, but you could only access two of them when it comes time to use those plots in strategy builder.

          It seems that it should be a simple thing to have it be selectable.

          Anyone care to make me look as simple as I genuinely am?
          I had the same problem. I think the answer has been given above, but maybe just not very clearly. I had an indicator with 3 parameters. You could edit these parameters from the indicator settings but these same settings were not all available to edit inside Strategy Builder. Only one of them was visible to edit.

          I used Ninjascript Editor to look at the indicator code. Down the bottom you will find "Parameters". And inside this section you will see this code: [NinjaScriptProperty].

          And here's what it might look like in full:
          [NinjaScriptProperty]
          [Range(1, int.MaxValue)]
          [Display(Name="ROC MA Length", Order=1, GroupName="Parameters")]
          public int ROC_MA
          { get; set; }

          In my case, the other two parameters which were defined in the indicator code but not visible in Strategy Builder had simply ONE difference to the parameter which was visible and editable in Strategy Builder. It was simply that the line [NinjaScriptProperty] was missing in the other two instances. I added this line to the other two instances and then, just like magic, those two parameters were also visible and editable inside Strategy Builder.

          That fixed my issue. I hope it fixes yours too. ​

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          56 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          133 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          73 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X