INPUT:M(26,5,300,30),P1(5,1,100,10),P2(10,1,100,10),P3(20,1,100,10);
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;
MID := (HIGH+LOW+CLOSE)/3;
CR:SUM(MAX(0,HIGH-REF(MID,1)),M)/SUM(MAX(0,REF(MID,1)-L),M)*100;
MA1:REF(MA(CR,P1),P1/2.5+1);
MA2:REF(MA(CR,P2),P2/2.5+1);
MA3:REF(MA(CR,P3),P3/2.5+1);
IF CROSS(DIFF,DEA) AND CR<100 THEN
BEGIN
SELLSHORT(1,0,MARKET);
BUY(1,1,MARKET);
END
IF CROSS(DEA,DIFF) AND CR>100 THEN
BEGIN
SELL(1,0,MARKET);
BUYSHORT(1,1,MARKET);
END