Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I want to execute on "touch" of the EMA's...

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

    I want to execute on "touch" of the EMA's...

    I'm trying to assemble the elements of an automation using Strategy Builder in NT8. I'm not good at or very conversant in Pseudo Logic, so I will attempt to explain my needs as simply as possible in plain language.

    I'm using a simple ema crossover strategy with period values at 2-32.

    Setting "Calculate to tick by tick" I want to execute an entry at a price as close as possible to the point where the ema's first touch. The problem is that the tail of the fast ema will touch and re-touch (many times). In simplest terms how can I limit the entry to the first touch only?

    I'd appreciate someone walking me through the steps in Strategy Builder. Thanks in advance for your help.

    John Dent
    Attached Files
    Last edited by NinjaTrader_PatrickH; 02-13-2018, 01:54 PM.

    #2
    Hello chofujohn,

    Thanks for your post and welcome to the NinjaTrader forums!

    You can create and use a bool variable (true or false only) that is set to false before the entry and then is set true after the entry. You would test for the bool to be false in the entry conditions. After the entry, the bool is set to true so the entry condition is no longer valid and no further orders can occur in that set until the bool is reset to false.

    In another set you would need to find a condition that you would use as a reset. (perhaps the opposite direction entry)

    I've attached an example for the entry condition to show how the bool would work. I named it FirstTouch which I have initialized to false. When the order is placed the bool is then set to true and this will prevent any further orders until the bool is reset to false.
    Attached Files
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      It's not working...

      Hi Paul,

      Thanks for the response and the solution. However, I've created and invoked the strategy and it's not working. I'm attaching the appropriate Strategy Builder screenshots.
      Attached Files

      Comment


        #4
        Hello chofujohn,

        Thanks for your reply.

        It looks like you are using the same bool in each of the sets. What i would suggest is using a different bool to control each set and then using the opposite set as the reset condition.

        For example, create a bool called bool2 to control set two.
        In Set 1, in the actions section, add the action to set bool2 to false (this is where you are also setting bool1 to true).
        In Set 2, in the conditions section change the condition to check if Bool2 is false (you have bool1 now). In the actions section, add the condition to set bool 2 to true.

        in summary:

        Set 1 conditions Crossabove, test if Bool1 is false
        Set 1 actions: Enter long, set bool 1 true, set bool 2 false

        Set2 conditions Crossbelow, test if bool 2 is false
        Set 2 actions: enter short, set bool2 true, set bool 1 false

        This set-up will prevent a long order until you have placed a short order and vice versa so that may not be what you want. You may have to use some other conditions to reset bool 1 and bool 2 back to false. Another example would be to reset the bool x number of bars after the last entry.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          It's needs more tweaking...

          Hi Paul,

          The trade is triggering now. Thanks. But, as in the example screenshot I'm attaching if the market moves in the opposite direction of the "touch/cross" then there is nothing to keep it from registering huge losses. I call it being "wrong footed". I'm very interested in learning your solution to the problem.

          John
          Attached Files

          Comment


            #6
            Hello chofujohn,

            Thanks for your reply.

            It appears the strategy did as you wish, IE: enter an order on the first cross when using Calculate.OnEachTick. The strategy cannot predict that the next bar would/will reverse so you would need to establish how you want the strategy to react to that situation.

            If the entry was not what you wanted then you would need to implement some other logic criteria to ensure you are getting the entry you wish.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Reaction of strategy AFTER the touch...

              Originally posted by NinjaTrader_Paul View Post
              Hello chofujohn,

              Thanks for your reply.

              It appears the strategy did as you wish, IE: enter an order on the first cross when using Calculate.OnEachTick. The strategy cannot predict that the next bar would/will reverse so you would need to establish how you want the strategy to react to that situation.

              If the entry was not what you wanted then you would need to implement some other logic criteria to ensure you are getting the entry you wish.
              Hi Paul,

              You are absolutely correct. The strategy executed exactly as requested. Thank you very much for your assistance. However, the strategy is not complete and there are additional elements I need to add.

              Please refer to the chart screenshot attachment as it explains exactly what I want.

              Paul, I know you'll get me to my ultimate goal and I want to thank you in advance.

              Best Regards,

              John Dent
              Attached Files

              Comment


                #8
                Hello chofujohn,

                Thanks for your reply.

                I'm sorry, we do not provide coding service. If you would like your strategy coded for you, we can provide references to 3rd party providers for this.

                To continue your understanding of the strategy builder please review the recorded webinar here: https://www.youtube.com/watch?v=HCyt...We0Nf&index=11

                You may also want to attend live strategy builder webinar training, here is a link to sign up: https://ninjatrader.com/Webinar/Strategy-Builder-301
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Coding service????

                  Originally posted by NinjaTrader_Paul View Post
                  Hello chofujohn,

                  Thanks for your reply.

                  I'm sorry, we do not provide coding service. If you would like your strategy coded for you, we can provide references to 3rd party providers for this.

                  To continue your understanding of the strategy builder please review the recorded webinar here: https://www.youtube.com/watch?v=HCyt...We0Nf&index=11

                  You may also want to attend live strategy builder webinar training, here is a link to sign up: https://ninjatrader.com/Webinar/Strategy-Builder-301
                  Just curious, but what do you think you've been doing? I've been providing the logic of what I want to do and you've been providing the coding through Strategy Builder. How is this request ANY different from the service you and others have been providing all along? Please have the department head of tech support contact me via telephone. There are some things I'd really like to discuss. I'm not at all happy. John Dent
                  Last edited by NinjaTrader_PatrickH; 02-13-2018, 01:43 PM.

                  Comment


                    #10
                    Hello chofujohn,

                    Thank you for your response.

                    Attached are the screenshots we discussed in .zip archives.

                    The first ones are the first Condition Set to determine if the position is short and if the bar touched the two EMAs. I used 10 and 20 for the periods of the EMAs.

                    The second ones are the second Condition Set to determine if the prior bar was as the first Condition Set and if the bar is now "red".

                    Please let me know if you have any questions.
                    Attached Files

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by gbal16, Yesterday, 08:12 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post gbal16
                    by gbal16
                     
                    Started by BraisedInBlue, Today, 06:43 AM
                    1 response
                    9 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Started by AaronKoRn, Today, 06:28 AM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_Zachary  
                    Started by Mabba, Today, 04:56 AM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Started by moehsan, Yesterday, 09:47 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Working...
                    X