I have a strategy that worked out nicely in historical / strategy analyzer tests, but when using it in 'live' trading using Sim101 it is suddenly showing every order entry as occuring twice at the exact same instance.
Here are the background details:
Using MB data feed, calculate on bar close = true
OnBarUpdate() it calls a method called CheckForPullBack()
CheckForPullBack() looks for entry conditions, then does this:
if(EntryOrder == null)
EntryOrder = SubmitOrder(0, OrderAction.Buy, OrderType.Stop, TradeSizeInt, 0, EntryLevel, "","LongPullBack1");
if(EntryOrder != null)
{
CancelOrder(EntryOrder);
EntryOrder = SubmitOrder(0, OrderAction.Buy, OrderType.Stop, TradeSizeInt, 0, EntryLevel, "","LongPullBack1");
}
The reason why it checks for != null and cancels is because I'm working with buy stops that may result in old ones needing to be removed before the revised order is issued.
My best guess for now is that somehow OnBarUpdate is being called twice and triggering two SubmitOrders even though I have CalculateOnBarClose = true, but that doesn't seem quite it either. Anyone have any thoughts?
Thanks!
Comment