input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);//macd参数设置
diff := ema(close,s) - ema(close,p);
dea : =ema(diff,m);
macd1 : =2*(diff-dea), colorstick;
input:max_hd(5,1,100,1);//最大持仓数量
if tsellholdingex('','',2)<max_hd and cross(0,macd1) then tbuyshort(1,1,mkt);
//止盈只能按照总的持仓均价计算盈亏,没办法每一笔单独止盈。
if tavgenterpriceex2('','',1)-c>=15*MINDIFF then tsellshort(1,0,mkt);
input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);//macd参数设置
diff := ema(close,s) - ema(close,p);
dea : =ema(diff,m);
macd1 : =2*(diff-dea), colorstick;
input:max_hd(5,1,100,1);//最大持仓数量
if tbuyholdingex('','',2)<max_hd and cross(macd1,0) then tbuy(1,1,mkt);
//止盈只能按照总的持仓均价计算盈亏,没办法每一笔单独止盈。
if c-tavgenterpriceex2('','',0)>=15*mindiff then tsell(1,0,mkt);