I'm running an automated strategy across multiple markets that works great, but once an order has been executed in a specific market, something in my code prevents the strategy from triggering a subsequent order in that same market.
When the trade is cancelled, the bool flag "orderPlacedLong" is set to false but when the trade is executed, I'm not sure how to set that same flag to false to allow the code to trigger another trade.
Thanks for your pointers.
Here's the code snippet:
if (!orderPlacedLong && my criteria here)
{
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.StopLimit,High[0]+1*TickSize,High[0]+1*TickSize, TimeInForce.Day, orderId, "MyStrat", GetAtmStrategyUniqueId());
orderPlacedLong = true;
}
else if (orderPlacedLong == true && High[0] <= High[1])
{
AtmStrategyCancelEntryOrder(orderId);
orderPlacedLong = false;
}
Comment