input:lots(1,0,9,1);
input:n(4,0,9,1);
input:n1(0.002,0.001,1,0.001);
input:M(30,0,50,1);
VARIABLE:maxprofit=0;
win:=0;
win2:=0;
RSI:=ref(SMA(MAX(CLOSE-REF(CLOSE,1),0),N1,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),N1,1)*100,1);
UP:=ref(hhv(h,20),1);
LD:=ref(llv(l,20),1);
if time>=091600 and time<150500 then begin
if holding=0 then begin
if h>=up and Rsi<80 then begin
buy(holding=0,lots,limitr,max(open,up));
maxprofit:=0;
end
if l<=ld AND Rsi>20 then begin
buyshort(holding=0,lots,limitr,min(open,ld));
maxprofit:=0;
end
end
end
if holding>0 and enterbars>0 then begin
win:=c-enterprice;
if win>maxprofit then
maxprofit:=win;
win2:=(maxprofit-win)/maxprofit*100;
end
if holding>0 and enterbars>0 then begin
多止损:sell(win<=-10,lots,LIMITR,c);
多止盈:sell(maxprofit>20 and win2>=60 and openprofit>0,lots,limitr,c);
end
if holding<0 and enterbars>0 then begin
win:=enterprice-c;
if win>maxprofit then
maxprofit:=win;
win2:=(maxprofit-win)/maxprofit*100;
end
if holding<0 and enterbars>0 then begin
空止损:sellshort(win<=-10,lots,limitr,c);;
空止盈:sellshort(maxprofit>20 and win2>=60 and openprofit>0,lots,limitr,c);
end
if holding<0 then begin
if h>=up then begin
sellshort(holding<0,0,limitr,max(open,up));
end
if time>=151400 then begin
sellshort(1,lots,thisclose);
end
end
if holding>0 then begin
if l<=ld then begin
sell(holding>0,0,limitr,min(open,ld));
end
if time>=151400 then begin
sell(1,lots,thisclose);
end
end