View Full Version : Initiate a reverse trade when stopped out
alanterry
03-26-2009, 10:11 AM
Can anyone please tell me if there is a way to set up the conditions in the Strategy Wizard so that when the current trade is stopped out a trade in the opposite direction is entered?
ie: The triggering of the stop loss is the condition required to enter the next trade.
There is sure to be a post already in the forum, but I can't find it (if it is here).
Thanks.:confused:
NinjaTrader_Josh
03-26-2009, 10:16 AM
alanterry,
How are you stopping out of your position? If you are explicitly coming up with some number to exit at instead you can just submit an EnterShort() order. That will automatically close the long position and buy a short position for you.
alanterry
03-26-2009, 01:48 PM
Thanks Josh.
I want to change direction at a stop loss that has been set as a certain number of ticks. I have been setting this on the "Stops and targets" screen of the Strategy Wizard. I can't work out how to do what you suggest.
NinjaTrader_Josh
03-26-2009, 02:00 PM
alanterry,
Instead of using that Stops & Targets page please try this instead. Go back to the Conditions & Actions page and then create a simple condition that checks the Close price vs your average entry price. Offset the entry price by the ticks you want your stop loss to be, then as your action just tell it to do EnterShort().
When price touches your avg entry price + offset ticks that means your stop was reached, and submitting the short would close your long (like a stop loss) and reverse you into a short position.
alanterry
03-26-2009, 03:41 PM
Getting better! Really appreciate your comments.:)
Is there a way that I can limit the reversal to just ONE time, and after that have the normal system entries resume?
NinjaTrader_Josh
03-26-2009, 03:50 PM
alanterry,
Sure. Limit your first set of orders by a User Variable. Check that a User Variable equals 0 before entering. Once entered set that equal to 1. When you do this that set will never execute again.
Then for your reentries just create a new set without this limitation.
alanterry
03-26-2009, 05:25 PM
Josh,
Nearly there, I suspect!! (And learning heaps in the process.)
The only trouble now is that the losing trades keep on repeating until there is a winning trade, which stops the sequence.
Can I stop this sequence after two losing trades?
NinjaTrader_Josh
03-27-2009, 07:11 AM
You will want to use the sections inside the Strategy category to capture the PnL. Then you can increase another User Variable each time it is a losing trade. When the User Variable reaches 2, don't trade any more.