Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaScriptProperty preset of boolean variable

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

    NinjaScriptProperty preset of boolean variable

    Hello,

    I would like to use properties in a strategy. When using a variable with type bool, I want to preset it with true. Using integer this can be done with range. How can I do that with a boolean type? Here an example:

    [NinjaScriptProperty]
    [Display(Name = "UseMovingAverage", GroupName = "Parameters", Order = 1)]
    public bool UseMovingAverage{ get; set; }

    How can I initialize the variable with UseMovingAverage=true when inserting the strategy?

    Kind regards
    Gerik

    #2
    Hello Gerik,

    Thank you for your inquiry.

    You would set the default value of your bool input in State.SetDefaults.

    In State.SetDefaults:

    Code:
    MyBool                    = true;
    In the Properties region:

    [NinjaScriptProperty]
    [Display(Name="MyBool", Order=1, GroupName="Parameters")]
    public bool MyBool
    { get; set; }

    Please let us know if you have any further questions.

    Comment


      #3
      Thank you Gaby! :-)

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kinfxhk, 07-14-2026, 09:39 AM
      0 responses
      17 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 10:18 AM
      0 responses
      59 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 09:50 AM
      0 responses
      43 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 07:21 AM
      0 responses
      47 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-11-2026, 02:11 AM
      0 responses
      38 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X