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 to define if condition a,b,c occur at the same time,not trigger signal

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

    How to define if condition a,b,c occur at the same time,not trigger signal

    Dear Team,
    This will be a little hard.


    For example,usually I use groupA to entry long.

    But if the ATRTRING AND EMA and SuperTrend falling at the same time.

    In this scenario,groupA will not be triggered.

    How to do this in strategy builder?

    My challenge is in strategy builder I can only add one condition at a time to restrict groupA.

    For example,the the group for all I can add falling ATRTRING is not true and then add falling EMA is not true,and falling SuperTrend is not true.

    This means any of the 3 scenarios occurs, groupA will not be triggered,but what I really want is,only when the 3 scenarios occur at the same time,groupA not be triggered.

    So what I want is not:

    if (! a && ! b&& ! c)
    EnterLong;

    What I want is:

    if (!(a&&b&&c))
    EnterLong;

    Really Appreciate!

    Thank you!

    #2
    My challenge is in strategy builder I can only add one condition at a time to restrict groupA.

    For example,the the group for all I can add falling ATRTRING is not true and then add falling EMA is not true,and falling SuperTrend is not true.

    This means any of the 3 scenarios occurs, groupA will not be triggered,but what I really want is,only when the 3 scenarios occur at the same time,groupA not be triggered. xender discord omegle
    Last edited by WAILITA; 08-18-2019, 12:20 PM.

    Comment


      #3
      Hello williamzz,

      If a set of conditions are true you can always set a variable.

      However, I'd like to assist with the condition groups.

      When you mention:
      "what I really want is,only when the 3 scenarios occur at the same time,groupA not be triggered"

      So if the conditions for the first group are true AND

      IsFalling(ATR(14)) != false and isFalling(EMA(14)) != false and SuperTrend() != false,

      then trigger action?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thank you for your reply.

        Actually, it is when IsFalling(ATR(14)) != false and isFalling(EMA(14)) != false and SuperTrend() != false occur at the same time.
        Not only one of them occur or two of them occur,but 3 of them occur at the same time.

        Now I know how to do it by code:

        public bool conditionabc = true;

        if (IsFalling(ATR(14)) !=false && isFalling(EMA(14)) != false &&SuperTrend() != false
        )
        {
        conditionabc = true;

        }

        if(firstgroup&&conditionabc){
        EntryLong;
        }

        Actually,I can add conditonabc=true into firstgroup directly.

        Now I don't think strategy builder has such function to deal with such a complicated logic,right?
        Last edited by williamzz; 08-18-2019, 05:54 PM.

        Comment


          #5
          Hello williamzz,

          When you mention:
          "Actually, it is when IsFalling(ATR(14)) != false and isFalling(EMA(14)) != false and SuperTrend() != false occur at the same time."

          Is this when you want the action to happen or do you want the action suppressed?

          What you want to happen?

          Yes, the strategy builder can do OR and can do ANDS and can use variables that would be used in another condition set.

          Right now lets clarify on the condition and action you want.

          So if atr is falling and ema is falling and supertrend plot is true then trigger action?

          It almost doesn't sound like you need groups, just a few conditions
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            when IsFalling(ATR(14)) != false and isFalling(EMA(14)) != false and SuperTrend() != false occur at the same time,entry long will not be triggered by groupA. Otherwise in all other scenarios,entry long will be triggered normally by groupA.

            Comment


              #7
              Hello williamzz,

              Think of it the other way. What conditions need to be true for the action to take place?

              If (some unknown conditions here) AND IsFalling(ATR(14)) == false AND IsFalling(EMA(14) == false AND SuperTrend() == false, then trigger action?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thank you very much!It is a very good idea.

                The reason why I did't think about this idea.Is because the structure of my strategy in strategy builder is like this:

                if any:
                (group1;group2;group3;groupA)

                Entry Long;

                This is many groups to one action. (GroupA is the group that I want to restrict.)

                But now I can change the structure into:

                if all/any
                group1

                Entry Long1;


                if all/any

                group2

                Entry Long2;

                if all/any

                group3

                Entry Long3


                if all/any
                groupA
                Entry LongA

                This is one group to one action.

                If so I can put IsFalling(ATR(14)) == false AND IsFalling(EMA(14) == false AND SuperTrend() == false into another group named groupRestrict.And build it like this:


                if all
                IsFalling(ATR(14)) == false
                IsFalling(EMA(14) == false
                SuperTrend() == false


                And then do like this:

                if all
                groupA;
                groupRestrict;

                Entry LongA


                At this time groupRestrict actually means:

                IsFalling(ATR(14)) == false
                IsFalling(EMA(14) == false
                SuperTrend() == false

                occur at the same time!Right?Because I used if all notif any.

                I'm very excited now.You help me a lot!


                I will try this.

                Really appreciate your following up and help!

                Comment


                  #9
                  Hello williamzz,

                  I have received a private email from you at platformsupport [at] ninjatrader [dot] com.

                  So that we are not communicating in two places, I will continue this conversation privately through email.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by merzo, 06-25-2023, 02:19 AM
                  10 responses
                  823 views
                  1 like
                  Last Post NinjaTrader_ChristopherJ  
                  Started by frankthearm, Today, 09:08 AM
                  5 responses
                  15 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  43 views
                  0 likes
                  Last Post jeronymite  
                  Started by yertle, Today, 08:38 AM
                  5 responses
                  16 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by adeelshahzad, Today, 03:54 AM
                  4 responses
                  20 views
                  0 likes
                  Last Post adeelshahzad  
                  Working...
                  X