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 frankthearm, Yesterday, 09:08 AM
        12 responses
        43 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by junkone, Today, 11:37 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        35 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        35 views
        0 likes
        Last Post love2code2trade  
        Working...
        X