Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to remove an existing parameter of indicator?

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

    How to remove an existing parameter of indicator?

    Hi
    I develop indicator in NT8.
    Suppose initially I generated the indicator with the wizard with parameters A,B,C .
    The wizard generate base code . include A,B,C.
    Logic with A,B and C was generated within the region "NinjaScript generated code"
    As development progress I decided to add another parameter called D .
    I added parameter D to region Properties and after compilation D was added automatically to region "NinjaScript generated code" .
    As development progress I decided to remove parameter C ( it is not needed)
    if I simply remove it from region Properties and compile I get error messages .
    What is the proper way to remove a parameter from indicator ?

    #2
    Hello doron,

    Thank you for writing in.

    Once you have removed the particular property, have you deleted the variable assignment within State.SetDefaults for that property as well?

    Code:
    protected override void OnStateChange()
    {
         if (State == State.SetDefaults)
         {
              [B]A = 1; // remove this[/B]
         }
    }
    
    #region Properties
    [Range(1, int.MaxValue)]
    [NinjaScriptProperty]
    [Display(Name="A", Order=1, GroupName="Parameters")]
    public int A
    { get; set; }
    #endregion
    If so, and you are still seeing an error, can you provide a screenshot of the error that you are seeing?

    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.

    Click here for instructions

    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

    Click here for detailed instruction
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      hi

      the error after i remove a parameter is in the region "NinjaScript generated code"

      I found that if i remove this region as i delete the parameter this region is regenerated again without an error

      is this the correct procedure ?

      Comment


        #4
        Hello doron,

        You should not be modifying the NinjaScript generated code region.

        Once you have removed the property and its variable assignment, the NinjaScript generated code region will regenerate without reference to that removed property.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          as i wrote after removing a parameter the regeneration process of this region has a problem.
          try it you will see

          Comment


            #6
            Hello doron,

            You should not be removing or modifying anything within the NinjaScript generated code region.

            If you are seeing errors after modifying it, please delete the region and recompile so a new NinjaScript generated code region is generated.

            I am not seeing a compile error once I have removed a property from the script within the Properties region and removing its variable assignment.
            Last edited by NinjaTrader_ZacharyG; 04-28-2016, 08:06 AM.
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              sorry you are correct i retried it and i see no problem now
              i probably made a mistake
              thx

              Comment


                #8
                Note - if you comment out a parameter, the line [Category("Parameters")] will still be processed and you will get a compile error. Just do something like put a space in front of Parameters, as in [Category(" Parameters")], to fix that..

                Comment


                  #9
                  Hello grose,

                  It would be expected for a compile error to occur. A property will need to be combined with the attribute. You cannot add an attribute without an entity that uses it placed below it.

                  Please take a look at this page from MSDN for more information about attributes: https://msdn.microsoft.com/en-us/library/mt653979.aspx
                  Zachary G.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by junkone, Today, 11:37 AM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by frankthearm, Yesterday, 09:08 AM
                  11 responses
                  42 views
                  0 likes
                  Last Post frankthearm  
                  Started by quantismo, 04-17-2024, 05:13 PM
                  5 responses
                  35 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by proptrade13, Today, 11:06 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by love2code2trade, 04-17-2024, 01:45 PM
                  4 responses
                  35 views
                  0 likes
                  Last Post love2code2trade  
                  Working...
                  X