ma5:ma(c,5);
ma10:ma(c,10);
ma20:ma(c,20);
ma30:ma(c,30);
jc:cross(ma5,ma10);
jc10:cross(ma10,ma20);
jc20:cross(ma20,ma30);
sc:cross(ma10,ma5);
sc10:cross(ma20,ma10);
sc20:cross(ma30,ma20);
if jc then buy(holding=0,1,market);
if sc then sell(holding>0,holding,market);
if jc10 then buy(holding=0,1,market);
if sc10 then sell(holding>0,holding,market);
m3:=(t0totime(timetot0(closetime(0))-60*3));//收盘前3分钟的时间
if time>=m3 then Sell(holding>0,holding,market);//收盘前3分钟清仓
另一手隔夜:
以3分钟分时K线收盘价为准,20天线金叉30天线下一手多单,20天线死叉30天线反手做一手空单(平多下空)
if jc20 then buy(holding=0,1,market);
if sc20 then sell(holding>0,holding,market);
if sc20 then BUYSHORT(holding=0,1,MARKET);
请问老师这么写对吗?如果不对该怎么写?万分感谢!
variable:bj=0;
if 隔夜仓开仓条件 and holding=0 and bj=0 then begin
buy(1,1,thisclose);
bj:=1;
end
if bj=1 and holding>0 and enterbars=1 then begin
sell(1,0,thisclose);
bj:=0;
end
需要在日线上,其他周期的话,这样写:
variable:bj=0;
if 隔夜仓开仓条件 and holding=0 and bj=0 then begin
buy(1,1,thisclose);
bj:=DATETOD1970(date);
end
if DATETOD1970(date)=bj+1 and holding>0 then begin
sell(1,0,thisclose);
bj:=0;
end
但是要求是连续的两天,中间有休假日,就不行