With my code below, it keeps submitting the order on the ^TICK instead of the ES contract. Any idea why?
// Add a 100 tick Bars object for the ^TICK - BarsInProgress index = 1
Add("^TICK", PeriodType.Minute, 1);
Add(PeriodType.Minute, 1);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Make sure this strategy does not execute against historical data
if (Historical)
return;
// check if TICK closed above 'X' for short trades
if (Closes[1][0]>shorttickvalue
&& Position.MarketPosition == MarketPosition.Flat
&& tradeshort == true && orderId.Length == 0 && atmStrategyId.Length == 0)
{
// Enter SHORT if true
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Action.Sell, OrderType.Limit, Closes[0][0], 0, TimeInForce.Day, orderId, "ESTICKATM", atmStrategyId);
}
Comment