I am getting the following error when try to take long position by ATM.
Playback101, Buy stop or buy stop limit orders can't be placed below the market. affected Order: BuyToCover 1 StopMarket @ 80
Code:
void TakePosition()
{
Action<ErrorCode,string> callback = (atmCallbackErrorCode, atmCallBackId) => {
if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
isAtmStrategyCreated = true;
};
switch (GetBarStatus(CurrentBar))
{
case BarStatus.Falling:
AtmStrategyCreate(OrderAction.Sell, OrderType.Limit, GetCurrentAsk(), 0, TimeInForce.Day, orderId, ATMName, atmStrategyId, callback);
break;
case BarStatus.Rising:
AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, GetCurrentBid(), 0, TimeInForce.Day, orderId, ATMName, atmStrategyId, callback);
break;
default:
break;
}
}
Comment