//+------------------------------------------------------------------+
//| 检查平仓或挂单删除 |
//| 输入: 无。 |
//| 输出: true-如果交易操作处理完毕, 否则 false。 |
//| 备注: 无。 |
//+------------------------------------------------------------------+
bool CExpert::CheckClose()
{
double lot;
//--- 在调用之前仓位必须已被选择
if((lot=m_money.CheckClose(GetPointer(m_position)))!=0.0)
return(CloseAll(lot));
//--- 检查持仓类型
if(m_position.PositionType()==POSITION_TYPE_BUY)
{
//--- 检查平多头持仓 / 删除多头挂单的可能性
if(CheckCloseLong())
{
DeleteOrders();
return(true);
}
}
else
{
//--- 检查平空头持仓 / 删除空头挂单的可能性
if(CheckCloseShort())
{
DeleteOrders();
return(true);
}
}
//--- 返回无操作
return(false);
}
|