代码编写
////////////////////////////////////////////////////////////////////////////////////////////////////////// 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);