代码编写

//////////////////////////////////////////////////////////////////////////////////////////////////////////    
       if (data1.MarketPosition>0) {
        if (data1.high>=destprice) {
            data1.sell(0, destprice);
        }
        if (stoplost>0) {
            stopprice = data1.EntryPrice-stoplost*minp;
            if (data1.close<=stopprice) {
                data1.A_DeleteOrder();
                data1.sell(0, stopprice-minp*exoff);            
            }
        } else if (data1.barssincelastentry==1) {
            stopprice = data1.low[1] - minp; Commentary("止损价 = " + text(stopprice));
        }
        if (stoplost==0 and data1.barssincelastentry>=1 and data1.low<=stopprice) {
            data1.A_DeleteOrder();
            data1.sell(0, stopprice-minp*exoff);
        }
    } else if (data1.MarketPosition<0) {
        if (data1.low<=destprice) {
            data1.BuyToCover(0, destprice);
        }
        if (stoplost>0) {
            stopprice = data1.EntryPrice+stoplost*minp;
            if (data1.close>=stopprice) {
                data1.A_DeleteOrder();
                data1.BuyToCover(0, stopprice+minp*exoff);            
            }
        } else if (data1.barssincelastentry==1) {
            stopprice = data1.High[1] + minp; Commentary("止损价 = " + text(stopprice));
        }
        if (stoplost==0 and data1.barssincelastentry>=1 and data1.high>=stopprice) {
            data1.A_DeleteOrder();
            data1.BuyToCover(0, stopprice+minp*exoff);

代码编写区分大小写吗
/下面保本止损止盈代码编写错误。想实现:开仓后如果有浮盈20跳,就设开仓+1跳保本。止损30跳。 价格到上轨止盈。请老师指点。
代码编写
跨周期代码编写
代码编写
【求助】策略代码编写
止盈止损代码编写
代码编写求助
代码编写请教
老师有网格策略代码编写课程吗

您好!图表指令(Buy/Sell指令)是无法实现您想要的挂单的结果,这个是由图表指令的性质决定的。因为图表指令默认是一定能成交的,回测的绩效也是基于这个前提来做的。所以,写法错误的策略有可能存在偷价、未来函数等问题,那都是因为这图表指令是一个理论值。这也是为什么您的开仓指令还没有成交,平仓指令照常发出的原因。