obviously the order is rejected. I need to catch the rejection and issue a market order with whatever price I can get in order to not miss the move at all, even with unfavorable entry price.
though I have coded the bellow structure, I still get rejection and it doesn't work.
Can anyone advice what am i doing wrong?
if (State == State.SetDefaults)
{
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelCloseIgnoreRejects;
}
protected override void OnBarUpdate()
{
entryOrder=EnterLongStopMarket(1,entryprice,"Entry");
}
protected override void OnOrderUpdate(Cbi.Order order, double limitPrice, double stopPrice,int quantity, int filled, double averageFillPrice,Cbi.OrderState orderState, DateTime time, Cbi.ErrorCode error, string comment)
{
if (order.Name == "Entry")
{
entryOrder = order;
}
}
protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
{
if (entryOrder != null && entryOrder == execution.Order && execution.Order.OrderState == OrderState.Rejected )
{
if( GetCurrentAsk() > entryprice)
{
entryOrder=EnterLong(1,"Entry");
}
}
}

Comment