input:n1(32,6,50,1); W1:=-100*(HHV(H,N1)-C)/(HHV(H,N1)-LLV(L,N1))+50; if W1>45 AND REF(ANY(W1>45,9),1) then begin if HHV(H,5)>1.0094*C OR T2 then sell(holding>0, 0, thisclose); if W1<-45 AND REF(ANY(W1<-45,9),1) then begin if C>1.0094*LLV(L,5) OR T2 then sellshort(holding<0, 0, thisclose); |
input:n1(32,6,50,1);//参数n1,默认值为32
W1:=-100*(HHV(H,N1)-C)/(HHV(H,N1)-LLV(L,N1))+50;//定义w1
T1:=TIME>093000 AND TIME<143500;//时间段1,下单时间
T2:=TIME>150500;//时间段2,强平时间
if W1>45 AND REF(ANY(W1>45,9),1) then begin//满足w1>45和 前9个周期中任意一个周期满足w1>45 则平空开多
sellshort(holding<0, 0, thisclose);
buy(holding=0 AND T1, 1, thisclose);//开多还需要在T1时间内
end
if HHV(H,5)>1.0094*C OR T2 then sell(holding>0, 0, thisclose);//5周期最高价> 收盘价*1.0094 或者 T1时间时,平仓
if W1<-45 AND REF(ANY(W1<-45,9),1) then begin//满足w1<-45 和 前9个周期中任意一个周期满足w2<-45,则平多开空
sell(holding>0, 0, thisclose);
buyshort(holding=0 AND T1, 1, thisclose);//开空还要在T1时间内
end
if C>1.0094*LLV(L,5) OR T2 then sellshort(holding<0, 0, thisclose);//收盘价>5周期最低价*1.0094 或者在T2时间时,平空