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 tonynt, Today, 09:33 AM
    1 response
    2 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by minotti1, Today, 08:31 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Jim  
    Started by SmartArtsStudio, 05-15-2021, 10:46 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Airwave, Today, 06:02 AM
    2 responses
    19 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by bottakemoney, Today, 12:10 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Working...
    X