参数N默认10
DIRECTION:=CLOSE-REF(CLOSE,N);
XX:=ABS(CLOSE-REF(CLOSE,1));
VOLATILITY:=SUM(XX,N);
ER:=ABS(DIRECTION/VOLATILITY);
FASTC:=2/(2+1);
SLOWC:=2/(30+1);
SSC:=ER*(FASTC-SLOWC)+SLOWC;
CONSTANT:=SSC*SSC;
YY:=REF(CLOSE,1)+CONSTANT*(CLOSE-REF(CLOSE,1));
AA:=IF(SUM(1,0)=N+1,YY,0);
BB:=BARSLAST(AA>0);
DDD:=REF(CLOSE,BB);
DD:=REF(CLOSE,BB);
CC:CLOSE,LINETHICK0;
<%
NN= FFL.VarData("N")
VD= FFL.VarData("DD")
VC= FFL.VarData("CC")
Vonstant= FFL.VarData("Constant")
LT = UBound( VC )
for m=NN + 1 to LT
VD( m )=VD( m - 1 ) + Vonstant( m ) * ( VC( m ) - VD( m - 1 ) )
next
FFL.VarData("DD")=VD
%>
AMA:=DD;
FFILTER:=15/100*(STD(AMA-REF(AMA,1),N));
XA:=IF(AMA<REF(AMA,1),AMA,0);
XN:=BARSLAST(XA>0);
AMALOW:=REF(AMA,XN);
YA:=IF(AMA>REF(AMA,1),AMA,0);
YN:=BARSLAST(YA>0);
AMAHIGH:=REF(AMA,YN);
RR:=IF(AMAHIGH-AMA>FFILTER,-1,0);
TT:=IF(AMA-AMALOW>FFILTER,1,RR);
VAR1:=SUMBARS(VOL,CAPITAL);
VAR2:=DMA((HIGH+LOW+CLOSE*2)/4,0.9);
VAR3:=REF(EMA(VAR2,3),1);
TBP:VAR3,LINETHICK0,color99CC99;
TJ:=TT=1;
TJ1:=TT=-1;
TJ2:=TT=0;
多头持仓:STICKLINE(TJ,LOW,HIGH,0.8,0),colorFF;
STICKLINE(TJ,OPEN,CLOSE,7,0),colorFF;
STICKLINE(TJ,OPEN,CLOSE,5,0),colorFF;
空头持仓:STICKLINE(TJ1,LOW,HIGH,0.8,0),colorFF0000;
STICKLINE(TJ1,OPEN,CLOSE,7,0),colorFF0000;
STICKLINE(TJ1,OPEN,CLOSE,5,0),colorFF0000;
持币观望:STICKLINE(TJ2,LOW,HIGH,0.8,0),colorFF00FF;
STICKLINE(TJ2,OPEN,CLOSE,7,0),colorFF00FF;
STICKLINE(TJ2,OPEN,CLOSE,5,0),colorFF00FF;
VAR1:=ZIG(3,3);
VAR2:=VAR1-REF(VAR1,1);
OD:=REF(CROSS(VAR2,0),1);
OK:=REF(CROSS(0,VAR2),1);
DRAWICON(OD,LOW,4);
DRAWICON(OK,HIGH,5);