一目均衡(转换线、基准线、迟行带)-指标公式源码
input:n1(7,2,100),n2(21,2,100),n3(43,2,100);
AA:=(HHV(HIGH,120)-LLV(LOW,120))/30;
Var1:=(2*CLOSE+HIGH+LOW)/4;
转换线:(HHV(HIGH,n1)+LLV(LOW,n1))/2,coloraaff99,LINETHICK1;
基准线:(HHV(HIGH,n2)+LLV(LOW,n2))/2,colorff6dd8,LINETHICK1;
迟行带:"REFX@REFX"(CLOSE,n2),colorff9224,LINETHICK0;
POLYLINE(NOT(BACKSET(BARSTATUS=2,n2)),"REFX@REFX"(c,n2)),COLORff9224;
DRAWLINE(BACKSET(BARSTATUS=2,n2+1),迟行带,BARSTATUS=2,c,0),DOTLINE,colorffffff,layer0;
先行带A:REF((转换线+基准线)/2,n2),COLORYELLOW,LINETHICK1;
先行带B:REF((HHV(HIGH,n3)+LLV(LOW,n3))/2,n2),color909090;
STICKLINE(先行带A<先行带B,先行带A,先行带B,2,1.5),COLOR339933;
STICKLINE(先行带A>=先行带B,先行带A,先行带B,2,0.1),COLOR0033CC;
DRAWTEXT(CROSS(转换线,基准线) AND Var1<MIN(先行带A,先行带B),MIN(基准线,LOW)*0.995,'①'),COLORRED,ALIGN1;
DRAWTEXT(CROSS(转换线,基准线) AND RANGE(Var1,MIN(先行带A,先行带B),MAX(先行带A,先行带B)),LOW*0.995,'②'),COLORRED,ALIGN1;
DRAWTEXT(CROSS(转换线,基准线) AND Var1>MAX(先行带A,先行带B),LOW-AA*0.5,'③'),COLORRED,ALIGN1;
DRAWTEXT(CROSS(基准线,转换线) AND Var1<MIN(先行带A,先行带B),MAX(基准线,HIGH)+AA*2,'Ⅲ'),COLORFFFF66,ALIGN1;
DRAWTEXT(CROSS(基准线,转换线) AND RANGE(Var1,MIN(先行带A,先行带B),MAX(先行带A,先行带B)),MAX(基准线,HIGH)+AA,'Ⅱ'),COLORFFFF66,ALIGN1;
DRAWTEXT(CROSS(基准线,转换线) AND Var1>MAX(先行带A,先行带B),MAX(基准线,HIGH)+AA,'Ⅰ'),COLORFFFF66,ALIGN1;
{阴柱}
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,0,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,8,0 ),COLORFF9F68;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLOR009900;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLOR00AA00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLOR00BB00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLOR00CC00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLOR00DD00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLOR00EE00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1,0 ),COLOR00FF00;
{红柱}
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,0,0) ,COLORFFBBFF;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,8,0) ,COLORFF00FF;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,7,0) ,COLORFF22FF;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLORFF44FF;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,5,0) ,COLORFF66FF;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLORFF88FF;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLORFF99FF;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLORFFAAFF;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,1,0) ,COLORFFBBFF;
|