Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

int data can't be specified as negative

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

    int data can't be specified as negative

    Hi,

    I have a parameter in strategy that is a signed integer (int) , but then in strategy analyzer, i can't enter negative value in the optimize box, such as -4. Why is this? Any workaround?

    #2
    Hello ssg10,
    I am glad to help you.

    The integer(int) has a Minimum value assigned to it, like the int cannot be less than 1 etc.

    so a code will look like this

    Code:
    [Description("")]
    [GridCategory("Parameters")]
    public int MyInput0
    {
           get { return myInput0; }
           set { myInput0 = [COLOR=Red]Math.Max(1, value)[/COLOR]; }
    }
    In the above code, the int value cannot be less than 1 (one).

    To change the same you just remove the Math.Max part. So a modified code of the above will be like

    Code:
    [Description("")]
    [GridCategory("Parameters")]
    public int MyInput0
    {
           get { return myInput0; }
           set { myInput0 = [B][COLOR=Blue]value[/COLOR][/B]; }
    }
    the above will let you put in any value.

    If you have coded the strategy via the wizard, then please edit the same. In the User Defined Inputs box, assign a value like -9999 (mind the minus) in the Min field of the said int parameter.

    Please let me know if I can be of any further help.

    Regards,
    Joydeep.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    23 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    115 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    222 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    406 views
    0 likes
    Last Post CaptainJack  
    Working...
    X