KT交易师首先在公式系统的公共函数内新建一个XMA函数
INPUT:
NumericSeries X(100),
Numericsimple N(7);
Variable: VAR1(0);
P:=(DATACOUNT-BARPOS+1);
for i=1 to (N+1)/2 do Begin
VAR1:=VAR1+if(P=i,REFX(MA(X,N/2+i),N/2),0);
End
return IF(P =(N+1)/2,REFX(MA(X,N),(N-1)/2),VAR1);
然后再建立一个红色成交量公式即可
通达信系统自带XMA函数,直接引用原码新建公式
换手率:IF(C 1000,V,VOL / CAPITAL),VOLSTICK;
XA_1:=XMA(XMA(换手率,3),3);
XA_2:=XMA(XMA(换手率,5),5);
XA_3:=XMA(XMA(换手率,6),6);
XA_4:=XMA(XMA(换手率,8),8);
XA_5:=XMA(XMA(换手率,10),10);
XA_6:=XMA(XMA(换手率,12),12);
XA_7:=(XA_4+XA_5+XA_6+XA_1+XA_2+XA_3)/6;
XA_8:=XA_7*1.35;
XA_9:=XA_7*0.65;
XA_10:=XMA(XMA(换手率,16),16);
XA_11:=XMA(XMA(换手率,19),19);
XA_12:=XMA(XMA(换手率,22),22);
XA_13:=XMA(XMA(换手率,25),25);
XA_14:=XMA(XMA(换手率,28),28);
XA_15:=XMA(XMA(换手率,31),31);
XA_16:=(XA_10+XA_11+XA_12+XA_13+XA_14+XA_15)/6;
XA_17:=XA_16*1.4;
XA_18:=XA_16*0.6;
XA_19:=XMA(XMA(换手率,40),40);
XA_20:=XMA(XMA(换手率,50),50);
XA_21:=XMA(XMA(换手率,60),60);
XA_22:=(XA_19+XA_20+XA_21)/3;
XA_23:=XA_22*1.5;
XA_24:=XA_22*0.5;
XA_25:=XMA(XMA(换手率,90),90);
XA_26:=XMA(XMA(换手率,120),120);
XA_27:=XMA(XMA(换手率,150),150);
XA_28:=(XA_25+XA_26+XA_27)/3;
XA_29:=XA_28*1.3;
XA_30:=XA_28*1.8;
XA_31:=XA_28*0.5;
XA_32:=EMA(XA_7,10);
XA_33:=EMA(XA_16,10);
XA_36:=XA_9 XA_18 AND XA_18 XA_24 AND XA_24 XA_31;
XA_37:=XA_9 XA_18 AND XA_18 XA_24 AND XA_18 XA_31;
XA_38:=XA_9 XA_18 AND XA_18 XA_24 AND XA_18 XA_31;
STICKLINE(XA_16 XA_33,0,换手率,6,0),COLORMAGENTA;
STICKLINE(XA_7 XA_32,0,换手率,6,0),COLORRED;
STICKLINE(XA_16 XA_33 AND 换手率 XA_31,0,换手率,6,0),COLORWHITE;
STICKLINE(XA_16 XA_33 AND 换手率 XA_24 AND 换手率 XA_18 AND VOL XA_31,0,换手率,6,0),COLORBLUE;
STICKLINE(XA_16 XA_33,0,换手率,6,0),COLORGREEN;
{STICKLINE(XA_16 XA_33 AND XA_7 XA_32,0,VOL,2,0),COLORYELLOW;}
STICKLINE(XA_37=1 OR XA_38=1,0,换手率,6,0),COLORBLUE;
STICKLINE(XA_22 REF(XA_22,1) AND 换手率 XA_31,0,换手率,6,0),COLORWHITE;
V5:MA(换手率,5),COLORWHITE;
V10:MA(换手率,10),COLORYELLOW;