测试范例:
[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;
macdjc:cross(diff,dea),NODRAW;//macd金叉
macdsc:cross(dea,diff),NODRAW;
buy(macdjc and holding=0,1,market);
VARIABLE:sumGrossProfit:=0;
if macdsc and holding<>0 then //这里必须是完整平仓条件
begin
temp:=abs(holding);//holding在平仓语句之前 赋值给temp
sell(macdsc,holding,market);
sumGrossProfit:=((EXITPRICE-ENTERPRICE)*temp*MULTIPLIER)+sumGrossProfit;
end
show:sumGrossProfit;
资产:ASSET; |