 
等级: 超级版主
- 注册:
- 2021-5-18
- 曾用名:
|
ma1:ema(c,5);
ma2:ema(c,13);
ma3:EMA(c,30),LINETHICK2;
金叉:=cross(C,ma3+1);
死叉:=cross(ma3-1,C);
H1:VALUEWHEN(金叉,H+1),COLORRED,LINETHICK2;
L1:VALUEWHEN(死叉,L-1),COLORGREEN,,LINETHICK2;
止空:=cross(C,ma1+1);
止多:=cross(ma1,C);
止损1:VALUEWHEN(止空,H+2),COLORRED,LINETHICK2;
止损2:VALUEWHEN(止多,L-2),COLORGREEN,,LINETHICK2;
ss:=1;//手数
if H>H1 and O>ma3+0.5 then
begin
sellshort(1,holding,market);
buy(holding=0,ss,market);
end
if l<l1 and O<MA3-0.5 then
begin
sell(1,holding,market);
buyshort(holding=0,ss,market);
end
//最高价大于ma1止损
if O>ma1 and H>止损1 and holding<0 then 空损:sellshort(1,holding,market);
if O<ma1 and L<止损2 and holding>0 then 多损:sell(1,holding,market);
把止损放到代码最后面,这样止损后面就没有开仓 |
|