Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy parameters

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

    strategy parameters

    I would like to restrict the values of a parameter of a strategy to a few distinct values say 1, 2, 4, 6

    In the set method for the parameter should I do something like the following?

    set{
    if (value==1 || value==2 || value ==4 || value==6)
    {
    myparameter = value;
    }
    else
    {

    throw new Exception("Inavlid parameter");
    }
    }

    #2
    mballagan,

    No. That just means users typing in other values will have problems. Instead you should just do it in your OnBarUpdate where if the variable is 2 you do something, if it is 4 you do something else, but if it is 3 it just does nothing.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      parameters

      Thanks but the problem with that is that the user has no message indicating that they have entered an invalid parameter.

      Comment


        #4
        Right. What you want is not supported, but you can try your idea. If it is a int parameter it will be able to take on all values unless you generate some logic that resets it to some default value that is allowed.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        71 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        43 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        25 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        28 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        56 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X