[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;
mark:=0;
sellshort(macdjc,holding,market);//普通离场
if c-AVGENTERPRICE>=10*MINDIFF and holding<0 then
begin
止损离场:sellshort(1,holding,market);//止损离场
mark:=1;
end
LEN:BARSLAST(MARK=1);
buyshort(macdsc and holding=0 and (Len>=3 or not(len)) ,1,market);
以此为例,仅止损离场的情况才 才会3个周期后才允许开仓。普通离场情况下不限。
|