PDA

View Full Version : Multiple Concurrent Orders


monpere
05-16-2010, 01:17 PM
I have a strategy that tries to place 2 simultaneous limit orders in the simulator, 1 order above the market, 1 below the market. But only the first order in the strategy shows up on chart trader, the 2nd order seems to get lost. Both orders show up in the TraceOrders output log, but only the first one shows up on the chart. How do I place concurrent orders above and below the market?

Here's my reproducible strategy test code:

protected override void Initialize() {
CalculateOnBarClose = true;
TraceOrders = true;
EntriesPerDirection = 1000;
EntryHandling = EntryHandling.AllEntries;
}

protected override void OnBarUpdate() {
double hi = High[1] + (10*TickSize);
double lo = Low [1] - (10*TickSize);

Print("Bar " +CurrentBar +" Buy "+lo +" Sell " +hi);
EnterLongLimit ( 1, lo );
EnterShortLimit( 1, hi );
}

Here's the output:

Bar 148 Buy 1920.25 Sell 1926.75
5/16/2010 3:10:01 PM Entered internal PlaceOrder() method at 5/16/2010 3:10:01 PM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=1920.25 StopPrice=0 SignalName='' FromEntrySignal=''
5/16/2010 3:10:01 PM Entered internal PlaceOrder() method at 5/16/2010 3:10:01 PM: Action=SellShort OrderType=Limit Quantity=1 LimitPrice=1926.75 StopPrice=0 SignalName='' FromEntrySignal=''

NinjaTrader_RyanM
05-16-2010, 06:30 PM
Hello monpere,

Thank you for your post.

You are running into our internal order handling rules, found here: (http://www.ninjatrader-support.com/HelpGuideV6/Overview36.html)



Methods that generate orders (excluding market orders) to enter a position will be ignored if:

A position is open and an order submitted by an exit method (ExitLongLimit() (http://www.ninjatrader-support.com/HelpGuideV6/ExitLongLimit.html) for example) is active and the order is used to open a position in the opposite direction
A position is open and an order submitted by a set method (SetStopLoss() (http://www.ninjatrader-support.com/HelpGuideV6/SetStopLoss.html) for example) is active and the order is used to open a position in the opposite direction
The strategy position is flat and an order submitted by an enter method (EnterLongLimit() (http://www.ninjatrader-support.com/HelpGuideV6/EnterLongLimit.html) for example) is active and the order is used to open a position in the opposite direction
You would have to move to an unmanaged approach in version 7 to support two limit orders in the opposite direction.