Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Entry or Exit Bar

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

    Changing Entry or Exit Bar

    Any way to exit on the close of the bar that the conditions were met rather than at the open on the next bar? I realize that the closing of this bar is usually the same as the opening of the next bar but this inquiry is due to the following:

    What I see happening is say for example I'm long... and the exit Long condition signals... and the very next bar signals a short. What happens is the short signal won't enter or will enter a bar late (if the conditions for the short are still valid) because that bar it should enter on is exiting the long.

    It's probably a setting I need to set.

    Also, any way to enter at the close of the "signal" bar... ie. the bar where the conditions were met, rather than on the open of the next bar?

    #2
    Hello TicksBandit,

    Thank you for your note.

    If you were to run your strategy with Calculate set to On Each tick or On Price Change, so that your conditions are updating on each tick, then it’s possible to have your order fire off before the next tick of the new bar. See calculate, https://ninjatrader.com/support/help...?calculate.htm

    If you’re long and you get a sell signal to get short, two orders will be submitted, a sell to close and a sell to short order.

    What you could consider doing would be to move your if statements out of OnBarUpdate into a method, which you can then call from the strategy that’s running with calculate on each tick, but to prevent the strategy from evaluating until 1 minute before the close, you could use an if statement like below, where the evaluateConditionsTime is a DateTime object set to a time before the close.

    Code:
    if(Time[0] < evaluateConditionsTime) return;
    specialMethod();
    This would have the effect of jumping the gun on OnBarUpdate and would allow you to execute orders before technically the bar closed.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    58 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    133 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X