帮忙编写个程序:看1分钟K线做股指期货,在13:00-13:30.这个区间中有个高点和低点,破高点就开多,如果下来又破这个区间低点,就平多开空,每天最多两笔交易,收盘前一分钟清仓.
也就是多空各开仓一次?如果不反向突破那么就是开多一次或者开空一次?
对,就是这样.收盘前一分钟清仓
variable:n=0,m=0;
hh:valuewhen(time=133000,hhv(h,30));
ll:valuewhen(time=133000,llv(l,30));
tt:=time0<timetot0(closetime(0))-60;
if time>133000 and tt and h>hh and n=0 and holding<=0 then begin
sellshort(1,0,marketr);
buy(holding=0,1,marketr);
n:=1;
end
if time>133000 and tt and l<ll and m=0 and holding>=0 then begin
sell(1,0,marketr);
buyshort(holding=0,1,marketr);
m:=1;
end
if time0>=timetot0(closetime(0))-60 then begin
sell(1,0,marketr);
sellshort(1,0,marketr);
n:=0;
m:=0;
end
if time>140500 and tt and h>hh and n=0 and holding<=0 then begin
sellshort(1,0,marketr);
buy(holding=0,1,marketr);
n:=1;
end
if time>140500 and tt and l<ll and m=0 and holding>=0 then begin
sell(1,0,marketr);
buyshort(holding=0,1,marketr);
m:=1;
end
if time0>=timetot0(closetime(0))-60 then begin
sell(1,0,marketr);
sellshort(1,0,marketr);
n:=0;
m:=0;
end
谢谢 ,这样一个程序,还是交易股指日内:看1分钟K线,昨日的收盘价与今天的开盘价为区间, 两个价格有个高点跟低点, 在当日开盘5分钟后(也就是9:35分).如果价格已经突破区间高点就开始做多,每天做一笔交易, 止损为开仓价格的1%. 收盘前一分钟平仓, 作空相反,