Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

¿how can i define valid values for a boolean variable - input?

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

    ¿how can i define valid values for a boolean variable - input?





    people with nt,



    regards.



    i have tried to include public boolean variables in some strategies of mine so that one can choose the hours during which the strategy can trade - not trade and not have to create multiple versions of the strategy with these parameters hard coded.



    when i try to optimize strategies which include boolean variables, nt always shows 3 possible values: false, true, optimizable. ¿is it possible to get rid of the optimizable value and just have false - true available?


    i imagine that could be accomplished in the properties section but i haven't found boolean variables on any of the samples that nt makes available.


    [NinjaScriptProperty]
    [Range( )]
    [Display(Name=" ", Description=" ", Order= , GroupName=" ")]
    public int
    { get; set; }



    very well, regards.
    Last edited by rtwave; 10-23-2021, 02:19 PM.

    #2
    Hello rtwave,

    True means during the optimization the value will not be optimized over and will be true for every iteration.
    False, means during the optimization the value will be false for every iteration.
    Optimize means the value will be optimized and an instance of true and an instance of false will be created for each combination of other optimized inputs.

    It means you can turn optimizing a bool input on and off for each bool input for that test. We would not be removing the functionality. You can decide to just not optimize that input. You can also save an optimize template that has that value set to true or false instead of optimize.

    If you want a value to always be true. Don't make it a public input. Make it a private variable and set it to true.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3


      NinjaTrader_ChelseaB,



      thanks.


      the 3 possible values are quite intuitive and i have been able to use them without problem.


      my question was whether it could be possible to make true and false the only acceptable values for a variable by using c# code. i thought that maybe it could be possible to use code like this: { , } to define an exhaustive list of acceptable values. i have watched some tutorial videos and code like that is mentioned and explained.


      and no, i do not want to use private variables because then i would have to create multiple versions of every strategy when a boolean input provides flexibility and practicality.


      very well, regards.

      Comment


        #4
        Hello rtwave,

        Unfortunately, I am not understanding what you are trying to achieve. The input does not have to be optimized over. You can just set it to true or false.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5


          NinjaTrader_ChelseaB, people with nt,



          thanks.



          i think i have been able to figure this out.


          i can use public boolean variables and just ignore the optimizable value in the dropdown menu when optimizing.


          or i can use public integer variables to determine these inputs with only two possible values for each variable and then use the values from these variables inside my strategies to set as many private boolean variables as necessary to false - true. that should be a workable possibility.



          very well, regards.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by swestendorf, Today, 11:14 AM
          0 responses
          1 view
          0 likes
          Last Post swestendorf  
          Started by Sparkyboy, Today, 10:57 AM
          0 responses
          3 views
          0 likes
          Last Post Sparkyboy  
          Started by TheMarlin801, 10-13-2020, 01:40 AM
          21 responses
          3,917 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by timmbbo, 07-05-2023, 10:21 PM
          3 responses
          155 views
          0 likes
          Last Post grayfrog  
          Started by Lumbeezl, 01-11-2022, 06:50 PM
          30 responses
          812 views
          1 like
          Last Post grayfrog  
          Working...
          X