SETTLE;日内分时均线。MINPRICEC该合约的最小变动单位,CLOSEMINUTE<=2,CLOSEOUT;距离收盘2分钟平仓 |
n1:=todaybar;
dm:=4-INTPART(LOG(C));
SETTLE:ROUNDS(IF(sum(vol,n1)=0,C,sum(C*vol,n1)/sum(vol,n1)),2+dm),colorred;//均线算法
N:10;
SS:SETTLE;
MAH:MA(HIGH,N);//最高价的N周期平均
MAL:MA(LOW,N);//最低价的N周期平均
if C>SS and C<O and C<SS+3*mindiff then begin
sellshort(holding<0,holding,market);
buy(holding=0,holding,market);
end
if C<SS and C>O and C>SS-3*mindiff then begin
sell(holding>0,holding,market);
buyshort(holding<0,holding,market);
end
if time>=145800 then begin //1分钟周期才可以写145800
sell(holding>0,holding,market);
sellshort(holding<0,holding,market);
end
开空那里holding<0写错了,应该是holding=0.
n1:=todaybar;
dm:=4-INTPART(LOG(C));
SETTLE:ROUNDS(IF(sum(vol,n1)=0,C,sum(C*vol,n1)/sum(vol,n1)),2+dm),colorred;//均线算法
N:10;
SS:SETTLE;
MAH:MA(HIGH,N);//最高价的N周期平均
MAL:MA(LOW,N);//最低价的N周期平均
if C>SS and C<O and C<SS+3*mindiff then begin
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
if C<SS and C>O and C>SS-3*mindiff then begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end
if time>=145800 then begin //1分钟周期才可以写145800
sell(holding>0,holding,market);
sellshort(holding<0,holding,market);
end