MA5:=MA(C,5);
MA24:=MA(C,24);
MA72:=MA(C,72);
MA133:=MA(C,133);
MA200:=MA(C,200);
A1:=ABS((MA5-MA24)/MA24)*100;
A2:=ABS((MA5-MA72)/MA72)*100;
A3:=ABS((MA5-MA133)/MA133)*100;
A4:=ABS((MA5-MA200)/MA200)*100;
A5:=ABS((MA24-MA72)/MA72)*100;
A6:=ABS((MA24-MA133)/MA133)*100;
A7:=ABS((MA24-MA200)/MA200)*100;
A8:=ABS((MA72-MA133)/MA133)*100;
A9:=ABS((MA72-MA200)/MA200)*100;
A10:=ABS((MA133-MA200)/MA200)*100;
A11:=MA24>=REF(MA24,1) AND MA133>=REF(MA133,1)AND MA200>=REF(MA200,1);
A12:=MA72>=REF(MA72,1) AND MA133>=REF(MA133,1)AND MA200>=REF(MA200,1);
A13:=MA24>=REF(MA24,1) AND MA72>=REF(MA72,1)AND MA200>=REF(MA200,1);
A14:=MA24>=REF(MA24,1) AND MA133>=REF(MA133,1)AND MA72>=REF(MA72,1);
A15:=CROSS(CLOSE,MA24) OR CROSS(CLOSE,MA72)OR CROSS(CLOSE,MA133)OR
CROSS(CLOSE,MA200);
A16:=(OPEN<MA24 AND CLOSE>MA24)OR(OPEN<MA72 AND CLOSE>MA72)OR
(OPEN<MA133 AND CLOSE>MA133)OR(OPEN<MA200 AND CLOSE>MA200);
A17:=CROSS(MA5,MA24) OR CROSS(MA5,MA72) OR CROSS(MA5,MA133) OR
CROSS(MA5,MA200);
A18:=ABS((LOW-MA5)/MA5)*100;
A19:=ABS((LOW-MA24)/MA24)*100;
A20:=ABS((LOW-MA72)/MA72)*100;
A23:=A18<=1 OR A19<=1 OR A20<=1;
A24:=A23 AND CLOSE/OPEN>=1.04;
MAVOL:=MA(VOL,4);
A25:=COUNT(MAVOL>=REF(MAVOL,1),34)/34>0.5;
HH:=IF(C/REF(C,1)>1.098 AND L>REF(H,1),2*C-REF(C,1)-H,2*C-H-L);
V1:=BARSCOUNT(C)-1;
V2:=2*REF(C,V1)-REF(H,V1)-REF(L,V1);
NDB:=SUM(HH,0)+V2;
NDB1:=MA(NDB,3);
NDB2:=MA(NDB,24);
A26:=COUNT(NDB1>=REF(NDB1,1),28)/28>0.5 AND
COUNT(NDB2>=REF(NDB2,1),28)/28>0.5;
DIFF :=EMA(CLOSE,19) - EMA(CLOSE,35);
DEA := EMA(DIFF,20);
A27:=COUNT(DIFF>REF(DIFF,1),28)/28>0.5 AND
COUNT(DEA>REF(DEA,1),26)/26>0.5;
A28:=A1<=2 OR A2<=2 OR A3<=2 OR A4<=2;
A29:=A5<5 AND A5>=0 AND A6<5 AND A6>=0 AND A7<5 AND A7>=0 AND
A8<5 AND A8>=0 AND A9<5 AND A9>=0 AND A10<5 AND A10>=0;
A30:=A11 OR A12 OR A13 OR A14;
VOLUME:=MA(VOL,7)/VOL;
MID:=100*(HIGH+LOW-REF(HIGH+LOW,1))/(HIGH+LOW);
EMV:=MA(MID*VOLUME*(HIGH-LOW)/MA(HIGH-LOW,7),7);
A31:=EMV>0 AND EMV>=REF(EMV,1);
NDB11:=MA(NDB,5);
NDB22:=MA(NDB,10);
C1:=COUNT(NDB11>=REF(NDB11,1),40)/40>0.5 AND
COUNT(NDB22>=REF(NDB22,1),28)/28>0.5;
DIFF1 :=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA1 := EMA(DIFF1,9);
C2:=COUNT(DIFF1>REF(DIFF1,1),32)/32>0.5 AND
COUNT(DEA1>REF(DEA1,1),31)/31>0.5;
C3:=A5<4 AND A5>=0 AND A6<4 AND A6>=0 AND A7<4 AND A7>=0 AND
A8<4 AND A8>=0 AND A9<4 AND A9>=0 AND A10<4 AND A10>=0;
A32:=A25 AND ((A26 AND A27 AND A29)OR(C1 AND C2 AND C3));
DPMA5:=MA(INDEXC,5);
DPMA24:=MA(INDEXC,24);
B1:=CLOSE>=MA5 AND MA5>MA24 AND A28 AND A30 AND A31 AND A32;
B2:=A15 OR A16 OR A17 OR A24;
XG:=B1 AND B2;
买入:IF(CROSS(XG,0.5),28,0);