input: n(9,1,60), p(2,1,60), Q(30,1,60);
Direction:=CLOSE - REF( CLOSE , N ) ;
XX:=Abs( CLOSE - REF( CLOSE , 1 ) ) ;
volatility:=SUM( XX , N ) ;
ER:=ABS( Direction / VOLatility ) ;
FastC:= 2 / ( p + 1 ) ;
SlowC:= 2 / ( q + 1 ) ;
SSC:=ER * ( FastC - SlowC ) + SlowC ;
Constant :SSC * SSC , Linethick0 ;
YY:=REF( Close , 1 ) + Constant * ( CLOSE - REF( Close , 1 ) ) ;
AA:=IF( SUM( 1 , 0 )= N + 1 , YY , 0 ) ;
BB:=Barslast( AA>0 ) ;
DD:=REF( C , BB ) ;
CC:CLOSE , Linethick0 ;
for m=N + 2 to DATacOUNT DO
DD[m]:=DD[m - 1] + Constant[m] * ( CC[m] - DD[m - 1] );
AMA:DD;
T1:=DD>REF(DD,1);
T3:=NOT(T1) AND abs(DD-ref(DD,1))/DD*10000
PARTLINE(T1,DD),COLORRED,LINETHICK2;
PARTLINE(T2,DD),COLORGREEN,LINETHICK2;
PARTLINE(T3,DD),COLORBLUE,LINETHICK2;
DRAWTEXT(ISLASTBAR AND T1,DD,'持
股'),COLORRED,SHIFT1;
DRAWTEXT(ISLASTBAR AND T2,DD,'持
币'),COLORGREEN,SHIFT1;
DRAWTEXT(ISLASTBAR AND T3,DD,'观
望'),COLORBLUE,SHIFT1;