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 create an Analyzing condition through strategy builder

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

    how to create an Analyzing condition through strategy builder

    Dear Team,
    I want to build a independent condition a little like a indicator in strategy builder.

    For example,I want to create a condition named A:

    A means:both falling rsi and falling macd are true at 0 bar ago.

    And then I have a entry long condition named LongCondition1.

    Now I want to add A=false into LongCondition1.

    So can you let me know how to build such a condition or indicator through strategy builder?

    #2
    Hello williamzz,

    You could do this using the User Variables.

    First go to the Inputs and Variables screen in the builder
    Add a variable, A as a bool type.
    In your set where you EnterLong, in the Action add a second action in addition to EnterLong
    In the action builder, select Misc -> Set A and set it to false.

    You can then use this variable in other conditions in the builder.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello williamzz,

      If you can only set it as a number it sounds like you used type int or double, you need type bool for this.

      You will need to remove any condition where you may have set A and then go back to the variables screen and change A to a bool type.

      After doing that you will see true/false.

      Alternatively you can leave it and use 0/1 it would be exactly the same using an integer to represent true/false.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Should I put this variable before my entry long or short step?

        I have 4 steps,1:entry long 2:exit long 3:entry short 4:exit short.

        And now I added a new step for variable A, in the condition area,I put all the conditions that I think A should have,in the action area I select Misc -> Set A and set it to false.

        So I think I need put this new step in the first step position right?Since the computer will read all the data and condition from the top to the end.

        Comment


          #5
          Hello williamzz,

          Are the other conditions dependent on A being true/false? If so, you are correct that needs to go in a set before the others. Very likely you would need this as set 1 and the remainder of sets which are dependent follow it.

          The script is read top to bottom, you are correct there as well so your assumption is likely correct here.

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            Hi Jesse,
            Really appreciate your support.
            But after tried many times,I found that no matter which condition I put A into it,the condition will be disabled.

            I have tried many times.Could you give me a remote support.
            Last edited by NinjaTrader_Jesse; 09-20-2019, 03:25 PM. Reason: removed email

            Comment


              #7
              Hello williamzz,

              If you are unable to get the condition to work, I would need to know what you created and then review that to better understand the problem. This is not something we can do on remote or over the phone but we can continue to work through the problem here or through platform support [at] ninjatrader.com. If you would like to continue this post, I would either need a screenshot of the conditions in question or for you to attach the script. The same would happen with the support email, I would need to first review the conditions to understand what should happen based on what was made.



              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Sure,here is the screen short.I will post the script later.

                Attached Files

                Comment


                  #9
                  // Set 1
                  if ((Open[0] > Close[0])
                  && (High[0] < High[1])
                  && (Low[0] < Low[1]))
                  {
                  Falling1 = true;
                  Draw.Text(this, @"Falling1", "", 0, 0);
                  }



                  // 066-DMHMA
                  || ((Times[0][0].TimeOfDay >= new TimeSpan(8, 30, 0))
                  && (Times[0][0].TimeOfDay <= new TimeSpan(15, 0, 0))
                  && (CrossAbove(DM1.DiPlus, DM1.ADXPlot, 3))
                  && (Open[0] >= Close[1])
                  && (High[1] > High[2])
                  && (Low[1] > Low[2])
                  && (Falling1 == false))

                  Comment


                    #10
                    Hello williamzz,

                    Looking at the images I don't see where you set this bool to false. What is the overall goal you want to use this variable for?

                    it looks like you are checking in set 1 for a condition and setting the bool to true. In another condition you are checking if it is false.

                    Was the intention to set this to false so the condition can happen the other Set?

                    I look forward to being of further assistance/
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Thank you very much for your question,this is a very import question.

                      My overall goal is:
                      Variable Falling1 is kind of down trend condition,my entry long signal condition need to exclude this situation.

                      So I set down trend condition Falling1==true in step1,
                      and then in my entry long condition I set Falling1 must be false,that means my long condition signal should not be triggered while in the down trend condition Falling1.

                      Yea,I can also set Falling1 = false in step1,and then in my entry long condition set Falling1 must be true.I think this is the same.

                      Comment


                        #12
                        The overall goal for me to set Variable is to exclude some situations.

                        Comment


                          #13
                          Hello williamzz,

                          The Falling1 variable is initialized as true. In Set 1 it is set to true if the conditions are true.

                          Is there anywhere this is set to false?

                          If not, this would mean Falling1 is always true and will never be false.

                          Are you wanting to reset Falling1 to false on each new bar before the other conditions?

                          If so, add a new condition set and drag it to the left to make it Set 1. Then don't add any conditions and set Falling1 to false.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14

                            If so, add a new condition set and drag it to the left to make it Set 1. Then don't add any conditions and set Falling1 to false.’Sorry can you show me how to do this?

                            Best regards!

                            Comment


                              #15
                              Hello williamzz,

                              Below is a link to a short video that demonstrates.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by elirion, Today, 01:36 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post elirion
                              by elirion
                               
                              Started by gentlebenthebear, Today, 01:30 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post gentlebenthebear  
                              Started by samish18, Yesterday, 08:31 AM
                              2 responses
                              9 views
                              0 likes
                              Last Post elirion
                              by elirion
                               
                              Started by Mestor, 03-10-2023, 01:50 AM
                              16 responses
                              391 views
                              0 likes
                              Last Post z.franck  
                              Started by rtwave, 04-12-2024, 09:30 AM
                              4 responses
                              34 views
                              0 likes
                              Last Post rtwave
                              by rtwave
                               
                              Working...
                              X