Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

User inputs -- manually created (not via wizard)

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

    User inputs -- manually created (not via wizard)

    I am attempting to create variables that are user settable inputs, basically so I can attempt optimization with a wide range of values. Am having a problem with a script that I am editing manually. my programming background is limited, so please help.

    I manually added the variable in #region variables like this:

    private
    int BollThresh = 20;

    and added a reference in #region properties near the end of the file like this.

    [Description("")]
    [Category(
    "Parameters")]
    publicint BollThresh
    {
    get { return BollThresh; }
    set { BollThresh = Math.Max(1, value); }
    }


    But the compiler does not like seeing both present. It barks at the properties entry and says "The type 'NinjaTrader.Strategy.LongHammerTrailingStop' already contains a definition for 'BollThresh' Strategy\LongHammerTrailingStop.cs 83 12."

    But if I omit the properties entry (which compiler passes the run with), then I won't see the variable listed as an adjustable option.

    Note that this code file doesn't have the Wizard XML at the end of it. Is this absolutely necessary to create user input variables? Does that require I create a hollow shell with my named variables the wizard that creates the XML, that I then paste my procedures in?

    Any quick and fast workarounds for nonwizard work?


    #2
    The problem is that you are declaring a property with the exact same name as a variable. Try changing your code to what I have written below. Notice the difference in case. The variable is "bollThresh" while the property is "BollThresh".

    Code:
    private int bollThresh = 20;
    
    [Description("")]
    [Category("Parameters")]
    public int BollThresh
    {
        get { return bollThresh; }
        set { bollThresh = Math.Max(1, value); }
    }
    RayNinjaTrader Customer Service

    Comment


      #3
      Thank you very much. very useful. now i'm not dependent on the wizard.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      569 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      548 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      548 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X