PDA

View Full Version : Entry and exit orders to the same bar


pragma
08-07-2008, 05:05 AM
Hi, I'm testing on NT a strategy I developed in tradestation; my question is about entry and exit orders sent at the same time to the same bar.

Actually my strategy is something like that:

if (EMA(Veloce)[0] < EMA(Lenta)[0])
EnterShortLimit();


ExitShortLimit();

In this case strategy sends an entry order to the first bar and after this an exit order to the next bar.
I need to send both the limit orders to the first bar; what is really important is to have both orders (the entry and the exit) sent to the same bar.

How can I solve this problem?

Thank you.

NinjaTrader_Ray
08-07-2008, 08:01 AM
Use SetProfiitTarget() this might help but please read and understand how this method works. Once it is called, it will always send profit target orders once a position is entered.

http://www.ninjatrader-support.com/HelpGuideV6/SetProfitTarget.html

pragma
08-07-2008, 10:08 AM
Thank You it works, but I cannot reverse any position once SetProfitTarget is called...can you suggest any way to do it? I mean exit from an entry order and reverse the position....thanx.

NinjaTrader_Ray
08-07-2008, 10:09 AM
You would have to reverse with a market order such as EnterShort() which will exit a long and open a short.

Check out the order handling rules for clarification what can/can't be done currently. At bottom of page of the following link.

http://www.ninjatrader-support.com/HelpGuideV6/Overview36.html

pragma
08-07-2008, 04:49 PM
I just do it but it doesn't work. SetProfitTarget cancels every other order sent like an EnterShortLimit to reverse the position.

If condition
EnterLongLimit ();
SetProfitTarget () ;
EnterShortLimit ();

After the close position with the profit target there is a new buy order and not a sell short to reverse the position.

I tried also moving the position of SetProfitTarget in the script but the result is the same.

NinjaTrader_Ray
08-07-2008, 04:56 PM
It will not ignore Market orders, but will other orders.

If condition
EnterLongLimit ();
SetProfitTarget () ;
EnterShortLimit ();

Clearly violate the order handling rules documented in the link I provided in my prior post.