Q:= (MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4;
MA24:=MA(C,24);
MA60:=MA(C,60);
N11:=BARSLAST(CROSS(C,MA24))+1;
N21:=BARSLAST(CROSSDOWN(C,MA24))+1;
DRAWCOLORKLINE(C>MA24,COLORMAGENTA,1);
DRAWCOLORKLINE(C>MA24&&ISDOWN,COLORMAGENTA,0);
DRAWCOLORKLINE(C>MA24&&EXIST(C>MA60,N11),COLORRED,1);
DRAWCOLORKLINE(C>MA24&&EXIST(C>MA60,N11)&&ISDOWN,COLORRED,0);
DRAWCOLORKLINE(C<MA24,COLORYELLOW,1);
DRAWCOLORKLINE(C<MA24&&ISDOWN,COLORYELLOW,0);
DRAWCOLORKLINE(C<MA24&&EXIST(C<MA60,N11),COLORGREEN,1);
DRAWCOLORKLINE(C<MA24&&EXIST(C<MA60,N11)&&ISDOWN,COLORGREEN,0);
HHV(H,30);
LLV(L,30);
LC := REF(CLOSE,1);
RSI1:SMA(MAX(CLOSE-LC,0),7,1)/SMA(ABS(CLOSE-LC),7,1)*100,NODRAW;
RSI2:SMA(MAX(CLOSE-LC,0),7,1)/SMA(ABS(CLOSE-LC),7,1)*100,NODRAW;
REF(CROSS(RSI1>80,0.5),1),SOUND('I');
REF(CROSS(RSI2>80,0.5),1),SOUND('I');
REF(CROSS(RSI1<20,0.5),1),SOUND('I');
REF(CROSS(RSI2<20,0.5),1),SOUND('I');