Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Place an order after requirement

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

    Place an order after requirement

    Hello,

    I wanted to know if there is a way to automate an order for a long position that is triggered when it reaches 75 ticks less than my conditions required.

    So I have my strategy built, but it would be nice to avoid the ‘drawdown’ that occurs after my orders are placed, and having the order placed once it reached something like 75 ticks less than it would originally do otherwise, would be awesome.

    I hope you understand what I am trying to ask, because it is kind of complicated to explain.

    Basically, all conditions are met according to strategy, rather than place a long position instantly at that current price, have it place an order once the price drops down to something such as -75 ticks under.

    let me know if this makes sense, thank you

    #2
    Hello Polufson,

    Thank you for the post.

    This would be a good use case for a bool variable and an double variable. You could use your first condition to toggle the bool variable to true and store the bars price. That would allow a second condition to start working and checking if the Price is less than -75 ticks from when your original entry condition began.

    Are you currently using the builder or manually coding this?


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

    Comment


      #3
      I am using the builder, I am not familiar with manually coding so I prefer to stick to the builder

      Comment


        #4
        Would you be able to expand further on using the bool/double in this instance. I definitely like when your team posts an example allowing me to upload the script and see it programmed into the builder.

        Thanks!!

        Comment


          #5
          Hello Polufson,

          When using the builder you can use the Inputs and variables screen to define variables. In that screen you could define both a bool variable and a double variable. The bool would need to start as false.

          In set 1, we will assume that's the condition to start the process, you would add an action to set the bool to true, Misc -> Set Your Bool Variable Name
          Also in set 1 as an action use Misc -> Set Double variable name -> Select the Close price

          In set 2 as the Condition you would check if User variables -> Bool variable name, In the center > Equals, On the right -> Misc -> True
          As another condition in set 2 you would now check the price.
          That would be Left: Price -> Close, for the offset select Ticks and Enter -75 as the Offset

          this is the general approach at toggling a second condition in the builder and storing a price.

          JesseNinjaTrader Customer Service

          Comment


            #6
            Hello Jesse,

            I am stuck on the 'set the Price - Close offset' part, what goes on the center and right side?

            Here are screen shots to see if I am doing this correctly...


            Click image for larger version  Name:	Set 1.png Views:	0 Size:	30.4 KB ID:	1115896Click image for larger version  Name:	Set 2.png Views:	0 Size:	31.3 KB ID:	1115897Click image for larger version  Name:	Inputs and Variables.png Views:	0 Size:	34.7 KB ID:	1115895

            Comment


              #7
              Hello Polufson,

              Sorry about that it looks like the end of that sentence was cut off. The right side would be your variable of the stored price and the center would be the greater or less than depending on the direction.

              It looks like in your image you may have used the name Double, you will want to avoid using the names that already exist like Double as that may cause problems. You would want to give it a relevant name for its purpose like storedEntryPrice.

              In your first set you are setting the values of the variables on every OnBarUpdate, that set would still need some kind of condition to happen and then store the price once and set the bool once.

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

              Comment


                #8
                Hello,

                so in the first set I need to add a condition? I want to make sure that it does not interfere with my time filters. The way I have it set up currently is the way I was shown by a Ninjatrader admin.

                could you help me add a condition in the first set that won’t interfere?

                Comment


                  #9
                  Hello Polufson,
                  so in the first set I need to add a condition? I want to make sure that it does not interfere with my time filters. The way I have it set up currently is the way I was shown by a Ninjatrader admin.
                  Yes, however if you need to use that set for resetting other variables related to the time you should add another set to control the bool variable and setting of the price. The purpose of that set is to control what you described that you wanted:

                  rather than place a long position instantly at that current price, have it place an order once the price drops down to something such as -75 ticks under.
                  We need to store the price at that time in order to use it for future calculations, that is the purpose of this set or to be the initial condition which happens prior to the price drop down.

                  The condition is whatever you would like that condition to be, that would be up to you and your trading goals. What I described is a small piece of logic and how to control a variable to do the secondary price condition. How you initiate that process and reset it would be completely up to your goal.

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

                  Comment


                    #10
                    Hi James,

                    I still cannot figure it out, take a look at my screenshots and see if you know whats wrong, thank you


                    Click image for larger version

Name:	Set 1.png
Views:	124
Size:	31.4 KB
ID:	1116060Click image for larger version

Name:	Set 2.png
Views:	118
Size:	32.9 KB
ID:	1116061Click image for larger version

Name:	set 3.png
Views:	115
Size:	36.0 KB
ID:	1116062

                    Comment


                      #11
                      Hello Polufson,

                      What part are you having difficulty with?

                      I see that you made some modifications, what was the result?

                      You additionally have some time conditions here, you may want to start a new empty strategy to explore this concept without any other conditions affecting it.

                      You will also need to at some point reset this the variables like when you become flat again, however that would depend on what you want your strategy to do.

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

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by judysamnt7, 03-13-2023, 09:11 AM
                      4 responses
                      57 views
                      0 likes
                      Last Post DynamicTest  
                      Started by ScottWalsh, Today, 06:52 PM
                      4 responses
                      35 views
                      0 likes
                      Last Post ScottWalsh  
                      Started by olisav57, Today, 07:39 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post olisav57  
                      Started by trilliantrader, Today, 03:01 PM
                      2 responses
                      19 views
                      0 likes
                      Last Post helpwanted  
                      Started by cre8able, Today, 07:24 PM
                      0 responses
                      9 views
                      0 likes
                      Last Post cre8able  
                      Working...
                      X