以下代码是我发送平仓订单的代码,A_SendOrder每次返回的都是false,而且委托列表里面也没有委托单,请问是什么原因造成平仓失败。
CloseLots = IIF(A_TodayBuyPosition(AccountIndex) > 0, A_TodayBuyPosition(AccountIndex), 0);
If(CloseLots > 0 && A_SendOrder(Enum_Sell,Enum_ExitToday,CloseLots,Price,AccountIndex))
{
PrintLog("**********平多仓,平仓仓位" + Text(CloseLots) + "**********");
Result = True;
}
CloseLots = IIF(A_BuyPosition(AccountIndex) > 0, A_BuyPosition(AccountIndex), 0);
If(CloseLots > 0 && A_SendOrder(Enum_Sell,Enum_Exit,CloseLots,Price,AccountIndex))
{
PrintLog("**********平多仓(昨仓),平仓仓位" + Text(CloseLots) + "**********");
Result = True;
} Else
{
PrintLog("卖出平仓,发送了" + Text(CloseLots) + "个委托单,关注后续成交情况");
ALert(SymbolName + "提示平多仓");
//ClosePosId = CreateTimer(5000,DateTimeAdd(CurrentTime(),1000),10);
}
exittoday换成exit试试