PDA

View Full Version : Avoid same bar execution


MrBaffalo
04-19-2007, 02:29 AM
How do I avoid same bar execution by scripting? Attached an Image of what I'm meaning.
This affect only backtest and past trades, during rt trading I think this should be ok


Thanks in advance for your suggestions

NinjaTrader_Ray
04-19-2007, 04:06 AM
The only way to do this is by managing your exit orders through Exit() methods and not SetStopLoss() or SetProfitTarget() and run with CalculateOnBarClose true or widening your stop/target prices on the 1st bar of a positon and then tightenting it on the next bar.

The reason is that SetStopLoss() related methods will make the order go live on the same bar that the position is opened. If the stop/target price is within the range of this bar, you get executed as you are reporting.

If you use an exit method, orders generated are executed on the following bar after a position has been opened.

Ray

MrBaffalo
04-19-2007, 05:30 AM
ok thanks for your suggestion

Marce

Sachin
10-29-2011, 02:57 AM
The reason is that SetStopLoss() related methods will make the order go live on the same bar that the position is opened. If the stop/target price is within the range of this bar, you get executed as you are reporting.


Hi, is there a way I can force the stop order to go live only on the next bar after entry (disallow same bar entry/exit).

BTW I am using NT7 and came across this thread by googling. I see many beginners struggle with the same problem of same bar entry/exit by the no. of threads discussing this.

NinjaTrader_AdamP
10-29-2011, 10:51 AM
Sachin,

I am happy to assist you.

Please follow Ray's recommendation. Essentially he is saying you can SetStopLoss() to something very low, then reset it to what you want the next bar. Otherwise, you can monitor your own stop loss in your strategy by using Exit() methods.

For more information on SetStopLoss(), please see the link below.

http://www.ninjatrader.com/support/helpGuides/nt7/index.html?setstoploss.htm

For more information on order methods (such as ExitLong()), please see the link below.

http://www.ninjatrader.com/support/helpGuides/nt7/index.html?order_methods.htm

For more information on managing stop-losses and take-profits, please see the following reference sample.

http://www.ninjatrader.com/support/forum/showthread.php?t=3222

Please let me know if I may assist further.