等级: 超级版主
- 注册:
- 2021-5-18
- 曾用名:
- FireScript
|
新建一个指标 '指标A',来进行调用:
[PEL] 复制代码
T:TIME;
N:=14;
M1:=3;
M2:=3;
GG:=75;
DD:=25;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,M1,1);
D:=SMA(K,M2,1);//KD指标
RSI:"RSI.RSI1";
MA3:=WMA(C,34);
VAR21:=CROSS(K,GG);
VAR22:=CROSS(DD,K);
VAR23:=BARSLAST(VAR21);
VAR24:=BARSLAST(VAR22);
VAR25:=SUM(VAR21,VAR24+1)=1 AND VAR21;
VAR26:=SUM(VAR22,VAR23+1)=1 AND VAR22;
DUO:=BARSLAST(VAR25)<BARSLAST(VAR26),NODRAW;
KONG:=BARSLAST(VAR25)>BARSLAST(VAR26),NODRAW;
cd1:CROSS(DUO,0.5);
cd2:CROSS(KONG,0.5);
然后当前运行的指标如下:
[PEL] 复制代码 N:=14;
M1:=3;
M2:=3;
GG:=75;
DD:=25;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,M1,1);
D:=SMA(K,M2,1);//KD指标
RSI:"RSI.RSI1";
MA3:=WMA(C,34);
VAR21:=CROSS(K,GG);
VAR22:=CROSS(DD,K);
VAR23:=BARSLAST(VAR21);
VAR24:=BARSLAST(VAR22);
VAR25:=SUM(VAR21,VAR24+1)=1 AND VAR21;
VAR26:=SUM(VAR22,VAR23+1)=1 AND VAR22;
DUO:=BARSLAST(VAR25)<BARSLAST(VAR26),NODRAW;
KONG:=BARSLAST(VAR25)>BARSLAST(VAR26),NODRAW;
STICKLINE(CROSS(DUO,0.5),0,100,0,0),COLORRED;
STICKLINE(CROSS(KONG,0.5),0,100,0,0),COLORGREEN;
N1:=5; //N1需要和STKINDIEX 函数里面参数对应。调整N1就是调整周期,但是需要和STKINDIEX里面参数一致。
T:=STKINDIEX('','指标A.T',0,N1,0,500);
cd1:=STKINDIEX('','指标A.cd1',0,N1,0,500);
cd2:=STKINDIEX('','指标A.cd2',0,N1,0,500);
STICKLINE(cd1 and t=time,0,100,0,0),COLORYELLOW;//颜色调整下和 当前周期区分开
STICKLINE(cd2 and t=time,0,100,0,0),COLORBLUE;
|
|