Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder - how to define the level for the order?

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

    Strategy Builder - how to define the level for the order?

    Hi, I want to add into the Strategy Builder that it shall put in a long/short order if the market breaks out of the range of the opening candle for example within 1 hour after the market opened. The time frame isn´t the problem. But how do I define the level where to put in the order?

    #2
    Hello Chris EA,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    You will create an order of your choosing to activate when the '1 hour has elapsed past open' condition is met. There are several different order types to make, I will use EnterLongLimit(double limitprice) as an example.

    You have the ability to make long/short entry orders in the 'Conditions and Actions' menu of the Strategy Builder.

    More info on all order methods here:
    https://ninjatrader.com/support/help...er_methods.htm

    The actions you define under 'Do the following' will activate when the conditions you make under 'If all/If any of the following conditions are met'.

    You could create a variable to act as a container for your limit price in the 'Inputs and Variables section', then use that variable in your logic and then eventually, to specify a price to set an order.

    What type of order were you looking to submit when your condition is met? Also what price level would you like to enter at? (Bid/Ask)

    I look forward to your reply.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_ChrisL,

      thank you for your help!

      How can I define the high of the opening candle as my price level where an order will be activated to make a long order?

      I think you said to do that in the 'Inputs and Variables section'. But how do I do that?

      Comment


        #4
        Hello Chris EA,

        Thank you for the reply.

        The inputs and variables seciton is a menu of the Strategy builder, you may click 'Next' in the builder and you will see two lists for user inputs and variables. Add a new variable called OpenHigh and make it a double. (Screen Shot 0)

        Then, add a condition set that checks if the current bar is the first bar of the session (Screen shot 1)
        If that is true, we will set the OpenHigh variable to High[0]. (Screen shot 2)

        When all of that is done, your Strategy Builder should look like Screen shot 3.

        Now make another condition set, where you will add your entry. So if all of your conditions are true for this condition set, Enter a long limit order and set the price to the OpenHigh variable. (Screen shot 4)


        Here is the youtube video and help guide on the Strategy Builder to get you started:

        https://www.youtube.com/watch?v=xpgC3wJTYMk
        https://ninjatrader.com/support/help...gy_builder.htm

        If there is anything else I may assist with please let me know.
        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hello NinjaTrader_ChrisL,

          thank you so much for your help! It worked really well how you described it.

          The only problem is that the long order is only activated if the first candle after the opening candle is breaking through the opening candle high. But it is supposed to work for every candle that breaks through within one hour. Even though I have defined the time frame in the Conditions noting changes.

          Do you know what the problem is?

          Kind regards
          Chris

          Comment


            #6
            Hello Chris EA,

            Thank you for the reply.

            I did not implement any conditions for position entry in my first post. I left that as an exercise for the reader.
            Could you please post a screenshot of your condition set for order entry?

            To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.

            Please see this publicly available link for instructions:
            https://support.microsoft.com/en-us/...#1TC=windows-8

            I look forward to your reply.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Hello NinjaTrader_ChrisL,

              thank you very much for your help!

              Picture 2 shows my condition set.

              Picture 1 shows in which cases there is a entry at the moment, whenever candle 2 breaks through the high of the opening candle.

              Picture 0 shows how it should work, that there is a entry for each candle that breaks long through the price high of the opening candle.

              I defined the time for the trades to happen. Strategiestart and Starteggieende are my starting/ending times that I defined in the 'Input' section. But for some reason it only uses the second candle instead of the whole timeframe that I defined.

              Best regards
              Chris
              Attached Files

              Comment


                #8
                Hello Chris EA,

                Thank you for the reply.

                You will need to group your order entry logic into a new condition set. At the conditions and actions menu, add a new set, then add your conditions for entry. This logic needs to be separated because in our first condition set we are checking if it is the first bar of the session and setting the variable. That is why we have the variable, for later use.

                If questions come up or if we may be of any further assistance, please let us know.
                Chris L.NinjaTrader Customer Service

                Comment


                  #9
                  Hello NinjaTrader_ChrisL,

                  I grouped the conditions for the time frame in the Conditions. In the Actions I can't group anything if I got that right.

                  But it is still not working. To be honest the tradingsystemanalysis doesn't work anymore either at the moment. I can't figure out why. I deleted all defintions with which I tried some things. Everything should be the right way now.

                  I attached a picture of my conditions and my actions.

                  I hope you can help me again
                  Attached Files

                  Comment


                    #10
                    Hello Chris EA,

                    Thanks for the reply.

                    Sorry, I should have been more clear, you need to set the order entry conditions in the own set. So toward the bottom of the conditions and actions menu, there is a tab called 'Set 1' click the plus next to it to create a new set and define your conditions and actions in set 2.

                    Please let me know if I may be of any further assistance.
                    Chris L.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello NinjaTrader_ChrisL,

                      that worked well. Thank you so much!

                      Comment


                        #12
                        Hello NinjaTrader_ChrisL,

                        I was a little bit too fast to think the problem is completly solved.

                        It is working much better now. For some days it is working perfectly but for some days the order entry is too late somehow. I made a screenshot of my problem. In this case the second candle already crosses the level for order entry but the order isn't opened before the third candle.

                        It doesn't really make much sense too me since on other days the order is already openend as soon as the market reaches the entry level no matter if its the second candle or the fifth etc.

                        Do you know how to solve this problem?

                        Kind regards
                        Chris
                        Attached Files

                        Comment


                          #13
                          Hello Chris EA,

                          Thanks for the follow-up.

                          Could you please post the strategy that has been generated?

                          You can find the strategy under ..\Documents\NinjaTrader 8\bin\Custom\Strategies

                          If you do not want to post the strategy please post screenshots of all the conditions and actions that you have set up.

                          I look forward to your reply.
                          Chris L.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello NinjaTrader_ChrisL,

                            this are my conditions and actions. They are just the ones you showed me.

                            Kind regards
                            Chris
                            Attached Files

                            Comment


                              #15
                              Hello Chris EA,

                              Thanks for the reply.

                              Please use print statements within the order entry condition group to make sure the entry is firing exactly when you want it to. In Do the following, add an action>misc>Print>Add a statement to print debug info to the output window. You can open a new output window by going to New>NinjaScript output.

                              Please let us know if we may be of any further assistance.
                              Chris L.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Franck Z, Today, 09:49 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post Franck Z  
                              Started by pvtrader, Today, 08:02 AM
                              2 responses
                              7 views
                              0 likes
                              Last Post pvtrader  
                              Started by Natoc, Today, 03:04 AM
                              1 response
                              17 views
                              0 likes
                              Last Post NinjaTrader_Jason  
                              Started by Rudy2323, Today, 02:56 AM
                              2 responses
                              28 views
                              0 likes
                              Last Post Rudy2323  
                              Started by tonynt, Yesterday, 02:07 PM
                              1 response
                              34 views
                              0 likes
                              Last Post NinjaTrader_Jason  
                              Working...
                              X