管理员救命.单程序老出问题,老会多补一手,然后平掉. [开拓者 TB]
作者:
开拓者 TB 来源:
cxh99.com 发布时间:2012年05月15日 点击数:
【
收藏到本网的会员中心】
- 咨询内容:
sjdc=A_buyPosition;
sjkc=A_SellPosition;
FileAppend("D:\\false.txt","实际多仓校验前"+Text(sjdc));
FileAppend("D:\\false.txt","实际多仓校验前"+Text(sjkc));
If(sjdc!=InvalidNumeric and sjkc!=InvalidNumeric)
{ If(A_GetOpenOrderCount()>0 )// and (CurrentTime-A_OpenOrderTime(0))*1000000>2
{FileAppend("D:\\false.txt","未成交挂单前"+Text(A_GetOpenOrderCount()));
A_DeleteOrder(A_OpenOrderContractNo());
}
FileAppend("D:\\false.txt","未成交挂单后"+Text(A_GetOpenOrderCount()));
If(A_GetOpenOrderCount()==0 )
{if(MyRealMP>=0)
{If(sjkc>0)
{A_SendOrder(Enum_buy,Enum_Exit,sjkc,Q_askPrice);
}else
If(sjdc>MyRealMP*EveryLots)
{ A_SendOrder(Enum_sell,Enum_Exit,sjdc-MyRealMP,Q_BidPrice);
}else
if(sjdc<MyRealMP*EveryLots)
{A_SendOrder(Enum_buy,Enum_Entry,MyRealMP-sjdc,Q_AskPrice);
}
}
IF(MyRealMP<0)
{If(sjdc>0)//实际多仓,A_sellpositon==NA
{A_SendOrder(Enum_Sell,Enum_Exit,sjdc,Q_BidPrice);
}else
if(sjkc>Abs(MyRealMP)*EveryLots)
{A_SendOrder(Enum_buy,Enum_Exit,sjkc-Abs(MyRealMP),Q_AskPrice);
}else
if(sjkc<Abs(MyRealMP)*EveryLots)
{A_SendOrder(Enum_Sell,Enum_Entry,Abs(MyRealMP)-sjkc,Q_BidPrice);
}
}
}
}
FileAppend("D:\\false.txt","实际多仓校验后"+Text(A_buyPosition));
FileAppend("D:\\false.txt","实际多仓校验后"+Text(A_buyPosition));
- TB技术人员:
交易的时候该补1手多单,老是会先开2手多单,再平掉1手。或者先开3手再平2手。有时候是正常的