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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X