Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to put a negative value in the Range attribute

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

    How to put a negative value in the Range attribute

    I am trying to put a negative number in a parameter but it keeps coming out zero. My Range looks like this:
    [Range(-5, 5)]
    [Display(Name="ExitTicks", Description="", Order=12, GroupName="Parameters")]
    public int ExitTicks

    I want to have a zero value where I can calculate 5 ticks above or 5 ticks below. So my range is -5 to +5. When I pass in -2 I get zero in my code. Is this possible to do? It seems like I have the syntax right.

    #2
    Hello cashinvestor,

    Thanks for your post.

    The syntax appears correct and when tested here I can get any value from -5 to +5, including 0.

    I would suggest debugging with a print statement to print to the output window the value of ExitTicks.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X