根据非注释部分的代码转换如下:
[PEL] 复制代码
input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);//参数设置
diff := ema(close,s) - ema(close,p);
dea : =ema(diff,m);
macd1 : =2*(diff-dea), colorstick;
k:=1;
buy(k and holding=0,1,market);
qj1:=if(diff <40 and diff>-40,0,1);
qj2:=if(dea <40 and dea>-40,0,1);
if cross(diff,dea) and qj1 and qj2 and (not(diff >40)) and (not(dea >40)) then buy(holding=0,k,market);
if cross(dea,diff ) and qj1 and qj2 and (not(diff <-40)) and (not(dea <-40))then buyshort(holding=0,k,market);
if cross(diff,dea) then sellshort(1,holding,market);
if cross(dea,diff) then sell(1,holding,market);
|