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

Master Conditional Arguments Kill Switch

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

    Master Conditional Arguments Kill Switch

    Objective: If a master conditional argument is not met, prevent all other conditional arguments from executing.

    I know this is also easily done by simply adding the conditional argument in question to each set of conditional execution statements ( If ).

    But for the sake of efficiency I want to make one master conditional IF statement that applies to the entire series of other conditionals. In essence a kill switch for all.

    Couldn't find anything on this.

    Thanx
    JM


    #2
    Hello JM,

    Thanks for your post.

    You would likely need to use a bool variable to accomplish this.

    If the conditions are true, you could set the bool variable to true in your script. If the conditions are not true, the bool could be set to false in your script.

    Then, you could use that bool variable later in the script by checking if its true or false for triggering actions.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Right. That means adding the bool argument though to each conditional IF set... What I'm looking to do is circumvent that by having one single conditional statement up top in the script to allow or deny execution of all. Can or cannot do?

      Thanx
      JM
      Last edited by johnMoss; 05-24-2023, 09:36 AM.

      Comment


        #4
        Hello JM,

        Thanks for your note.

        You would likely need to create a condition at the top of the script and flip a bool to true if that condition is true. Then, you could check if the bool is true and place your other conditions in that condition. Otherwise, you would need to add the bool argument to each condition as you noted.

        if (condition)
        {
        myBool = true
        }

        if (myBool == true)
        {
        //other conditions here
        }


        It would be up to you to come up with the custom logic to accomplish this specific goal.

        This forum thread will also be open for other community members to share their insights on the topic.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          copy, thank you

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ETFVoyageur, Today, 07:55 PM
          0 responses
          1 view
          0 likes
          Last Post ETFVoyageur  
          Started by janio973, Today, 07:24 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by aligator, 01-06-2022, 12:14 PM
          4 responses
          240 views
          0 likes
          Last Post john_44573  
          Started by reynoldsn, Today, 05:56 PM
          0 responses
          12 views
          0 likes
          Last Post reynoldsn  
          Started by bortz, 11-06-2023, 08:04 AM
          51 responses
          1,993 views
          0 likes
          Last Post aligator  
          Working...
          X