View Full Version : Profit Target and Stop Loss not honored
pjwinner
11-29-2007, 08:34 AM
When I'm backtesting th YM I get Close Position and Exit on Close numbers that are much higher than my Profit Target inputs. What can I do to get the Backtest to honor my PT and SL numbers?
NinjaTrader_Ray
11-29-2007, 09:17 AM
I suspect what you think should happen is really not what you coded. You will have to debug your strategy. Make sure that that the actual profit target prices are really at a lower price than the executed exit on close price. You could also verify this in a backtest by looking at the Orders Tab as you will see your profit target orders cancelled and the last price of the order.
Debug tip located here - http://www.ninjatrader-support.com/vb/showthread.php?t=3418
pjwinner
11-29-2007, 10:19 AM
Thanks, Ray. I can see I have something to learn about how orders are handled by NT. The suggestion to look at the Orders tab was helpful.
pjwinner
11-30-2007, 08:53 AM
What reasons might there be for cancelling PT/SL orders. I'm seeing this happen in the Orders Tab. It seems to happen at the same second the order is placed. So when price comes to the point where they should be hit they aren't there.
I followed the suggestion to debug the strategy. There is little to debug. There are 2 Conditions relating to an EMA, a Market Entry and the PT/SL's. What seems to be happening is something about how NT handles orders that I don't understand.
Thanks for the help.
NinjaTrader_Ray
11-30-2007, 09:00 AM
How are you submitting these orders? Via ExitLongLimit(), ExitLongStop() type commands or SetProfitTarget() etc...
If the former, orders expire at the end of a bar. Make sure you re-submit them.
pjwinner
11-30-2007, 09:33 AM
I'm using the SetProfitTarget() format.
NinjaTrader_Ray
11-30-2007, 09:45 AM
These are cancelled if one is filled or another order submitted that closes the position is executed.