Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

user defined parameters with upper and lower limit

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

    user defined parameters with upper and lower limit

    Ho do I define a parameter in the properties section that will allow me to set a lower and an upper limit to the value that is acceptable?

    the code below returns a value of 2 only, but I want it to be 1 or 2.

    publicint Var1{
    get { return var1; }
    set { var1 = Math.Max(1, 2); }
    }

    Thanks!

    #2
    malcolm, would unfortunately not be aware of a way, I would just limit one range in the properties and the other for example in OnBarUpdate()...if (Var1 > x) Var = x

    Comment


      #3
      Malcom,

      Try

      public int Var1
      {
      get { return var1; }
      set { var1 = Math.Min(Math.Max(1, value), 2); }
      }

      Greg
      Last edited by TheTradingMantis; 02-19-2011, 12:54 PM.
      The Trading Mantis
      NinjaTrader Ecosystem Vendor - The Trading Mantis

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      49 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      15 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      21 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      23 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X