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 PaulMohn, Today, 05:00 AM
        0 responses
        7 views
        0 likes
        Last Post PaulMohn  
        Started by ZenCortexAuCost, Today, 04:24 AM
        0 responses
        6 views
        0 likes
        Last Post ZenCortexAuCost  
        Started by ZenCortexAuCost, Today, 04:22 AM
        0 responses
        3 views
        0 likes
        Last Post ZenCortexAuCost  
        Started by SantoshXX, Today, 03:09 AM
        0 responses
        16 views
        0 likes
        Last Post SantoshXX  
        Started by DanielTynera, Today, 01:14 AM
        0 responses
        5 views
        0 likes
        Last Post DanielTynera  
        Working...
        X