HH:=HHV(H,enterbars);//定义高点,求开盘价以来的最高值,包括当前K线
LL:=LLV(L,enterbars);//定义低点,求开盘价以来的最低值,包括当前K线
//做多平仓
if (close-enterprice)/enterprice>(yinglifudu/100) and holding>0 then sell(1,0,marketr);//做多当涨幅大于8%时平仓
if HH>=(enterprice*1010/1000) and Close<=(enterprice*1002/1000) and holding>0 then sell(1,0,marketr);//做多时,当最高点大于进场价1%时,回撤进场价0.8%平仓
yinglifudu=8
[此贴子已经被作者于2015/2/9 14:30:40编辑过]
enterbars+1
要多加一个1,因为enterbars能够取值到0,所以要加1