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=''
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=''