Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is it possible to exit when price touches a moving average instead of on bar close?

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

    Is it possible to exit when price touches a moving average instead of on bar close?

    I have a strategy which may be more successful if the exit is when a moving average is touched rather than waiting for close of the bar as sometimes a reversal occurs at this point.

    My strategies are limited to the wizard which I believe will only execute on bar close.
    Has anyone any ideas?

    Steve

    #2
    Originally posted by stevep3 View Post
    I have a strategy which may be more successful if the exit is when a moving average is touched rather than waiting for close of the bar as sometimes a reversal occurs at this point.

    My strategies are limited to the wizard which I believe will only execute on bar close.
    Has anyone any ideas?

    Steve
    You will have to set CalculateOnBarClose to false to do that. If you do not want to write it into the indicator, you can always set it from the config GUI when you load the strategy.

    Comment


      #3
      Thanks kogonam for your reply

      I have tried calculate on bar close to false and it makes no difference to the result in my strategy. I do not know what GUI is. I searched help for GUI and I am told it is licencing and authentication.

      Steve

      Comment


        #4
        The GUI is the wizard. That's what he means... stands for Graphical User Interface...

        See: http://www.ninjatrader.com/support/f...ad.php?t=12913

        Comment


          #5
          Thanks trend747

          I believe that the condition that you referred me to triggers at the close of a bar, whereas I want is to trigger an exit when price reaches an MA rather than when the bar closes above or below it.

          Steve

          Comment


            #6
            Originally posted by stevep3 View Post
            Thanks trend747

            I believe that the condition that you referred me to triggers at the close of a bar, whereas I want is to trigger an exit when price reaches an MA rather than when the bar closes above or below it.

            Steve
            No bud, that thread is exactly what you are looking for... read the OP's post... he clearly wants a touch ema... To implement the solution (see the screenshot in the thread), I think you will need to CalculateOnBarClose = false. Note that COBC = false only works in real time or market replay... it does not work in backtesting.

            Comment


              #7
              Thanks trend747

              That COBC only works in realtime I had not realised. My input looks like this

              Close[0]<EMA(20)[0]

              ExitShort[' " ',' " ']

              In the example that you sent me, I don't know where the

              Enter Short(DefaultQuantity,SMA(20[0],')

              comes from as in the wizard the option seems to be only a simple order entry instruction like mine so I don't know if the above detail is necessary? Anyway mine works in backtest (though on bar close), and in realtime simulation, so if I uncheck COBC in my strategy, hopefully, my exit will trigger regardless of bar close.

              I intend to apply my strategy to live trading shortly. I hope it works with my real account as it does in simulation.

              stevep3

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              669 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              378 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              111 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              575 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              580 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X