开拓者期货期权程序化系统交易论坛

标题: 求助,为什么我写的语句平不了仓呢? [打印本页]

作者: wtf_lxd    时间: 2017-9-1 10:57:09     标题: 求助,为什么我写的语句平不了仓呢?

if (Condition1)
        {
                if(A_SellPosition()>0)
                {
                BuyToCover(A_SellPosition(),Q_AskPrice);
                Commentary("QB="+Text(Q_AskPrice));
            Buy(0,Q_AskPrice);
                }
                        Else if(A_SellPosition()==0&&A_BuyPosition()==0)
                Buy(0,Q_AskPrice);
        }
        if (Condition2)
        {
                if(A_BuyPosition()>0)
                {
                Sell(A_BuyPosition(),Q_BidPrice);
                Commentary("QS="+Text(Q_BidPrice));
                SellShort(0,Q_BidPrice);
                }
                Else if(A_SellPosition()==0&&A_BuyPosition()==0)
                SellShort(0,Q_BidPrice);
        }
每次都是开仓执行,就是无法将模拟账户的仓位平掉。




欢迎光临 开拓者期货期权程序化系统交易论坛 (http://bbs.tb18.net/) Powered by Discuz! X2