请问老师如何编写这个交易系统!
1 连续止损次数N始值为0,止损+1,连续止损连续+1,止赢后变回0;
2 开盘价以上开多,以下开空;
3 止损(>=5)点,止赢【>=10+(5*N)】点;
平仓后循环运行!
如菜粕RM1501,23号开盘价2120,在此价格以上买开,此价格以下就卖空,整天开仓都是如此
如菜粕RM1501,23号开盘价2120,在此价格以上买开,此价格以下就卖空,整天开仓都是如此
VARIABLE:n=0;
oo:VALUEWHEN(TODAYBAR=1,o);
buy(h>oo and holding=0,1,market);
buyshort(l<oo and holding=0,1,market);
if ENTERPRICE-l>=5 and holding>0 then begin//多头止损
sell(1,holding,market);
n:=n+1;
end
if h-ENTERPRICE>=5 and holding<0 then begin//空头止损
sellshort(1,holding,market);
n:=n+1;
end
if h-enterprice>=10+(5*n) and holding>0 then begin//多头止盈
sell(1,holding,market);
n:=0;
end
if ENTERPRICE-l>=10+(5*n) and holding<0 then begin//空头止盈
sellshort(1,holding,market);
n:=0;
end
[此贴子已经被作者于2014/9/25 17:36:27编辑过]