等级: 免费版
- 注册:
- 2021-5-20
- 曾用名:
|

楼主 |
发表于 2022-6-22 09:12
|
显示全部楼层
这样修改对不对?
//账户多头持仓
TbuyH:=tbuyholdingex('',STKLABEL,0);
//账户空头持仓
TsellH:=tsellholdingex('',STKLABEL,0);
//是否有未成交单,返回1表示有未成交
//Is_order:=TGLOBALSUBMITEX(0,'',stklabel,0);
Is_orderBuy:=TISREMAIN(1);
Is_orderSell:=TISREMAIN(2);
Is_orderBuyshort:=TISREMAIN(3);
Is_orderSellshort:=TISREMAIN(4);
//如果当前品种有挂单或者理论策略的当根k理论持仓有变化,就不执行
{
if Is_order then exit;
else
BEGIN
//多头部分
//理论持仓大于0,补仓
if BKhd<>0 and BKhd>TbuyH then
BEGIN
tbuy(1,BKhd-TbuyH,mkt);
END
//理论持仓大于0,减仓
if BKhd>=0 and BKhd<TbuyH then
BEGIN
tsell(1,TbuyH-BKhd,mkt);
END
//空头部分
//理论持仓小于0,补仓
if SKhd<0 and abs(SKhd)>TsellH then
BEGIN
tbuyshort(1,abs(SKhd)-TsellH,mkt);
END
//理论持仓小于0,减仓
if SKhd<=0 and abs(SKhd)<TsellH then
BEGIN
tsellshort(1,TsellH-abs(SKhd),mkt);
END
END
}
//{
if Is_orderBuy=1||Is_orderSell=1 then exit;
else
BEGIN
//多头部分
//理论持仓大于0,补仓
if hold0<>0 and hold0>TbuyH then
BEGIN
tbuy(1,hold0-TbuyH,mkt);
END
//理论持仓大于0,减仓
if hold0>=0 and hold0<TbuyH then
BEGIN
tsell(1,TbuyH-hold0,mkt);
END
END
if Is_orderBuyshort=1||Is_orderSellshort=1 then exit;
else
BEGIN
//空头部分
//理论持仓小于0,补仓
if hold1<0 and abs(hold1)>TsellH then
BEGIN
tbuyshort(1,abs(hold1)-TsellH,mkt);
END
//理论持仓小于0,减仓
if hold1<=0 and abs(hold1)<TsellH then
BEGIN
tsellshort(1,TsellH-abs(hold1),mkt);
END
END
//} |
|