以下是通达信指标四合主图源码

{可见K线 N=75条}; N:=89;

{可见K线 最高价}; HH:=CONST(HHV(H,N));

{可见K线 最低价}; LL:=CONST(LLV(L,N));

{可见K线 中间价}; MM:=CONST(HH/2+LL/2);

{最后  收盘价}; CC:=CONST(C),CROSSDOT;

{浮动线&0.2差值}; YY:=CONST(IF(CC>=MM,LL-(HH-LL)*0.2,HH+(HH-LL)*0.2)),POINTDOT;

{MACD:—————————————————————–};

{MACD  原参数}; DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);

{MACD  原参数}; DEA:=EMA(DIF,9);

{MACD  原参数}; MACD:=(DIF-DEA)*2,COLORSTICK;

{MACD N内最高线}; MHH:=CONST(HHV(MACD,N));

{MACD N内最低线}; MLL:=CONST(LLV(MACD,N));

{MACD N内均顶底}; MMM0:=MHH/2-MLL/2; MMM:=IF(MMM0< (HH-LL)*0.1,(HH-LL)*0.1,MMM0);

{浮动线 灰衬底}; STICKLINE(0=0,YY+MMM,YY-MMM,5,0),COLOR444444;

{浮动线上红MACD}; STICKLINE(MACD>=0 AND MACD>REF(MACD,1),YY,YY+MACD,0.2,0),COLORRED; {颠倒图};

STICKLINE(MACD>=0 AND MACD< REF(MACD,1),YY,YY+MACD,0.2,0),COLORFFFF00;

{浮动线下蓝MACD}; STICKLINE(MACD< 0 AND MACD< REF(MACD,1), YY,YY+MACD,0.2,0),COLOR00FF00; 

STICKLINE(MACD< 0 AND MACD>REF(MACD,1), YY,YY+MACD,0.2,0),COLOR00FFFF;

{KDJ3——————————————————————};

{KDJ3  原参数}; RSV:=((CLOSE-LLV(LOW,13))/(HHV(HIGH,13)-LLV(LOW,13))-0.5)/100;

{KDJ3  原参数}; K:=SMA(RSV,4,1);

{KDJ3  原参数}; D:=SMA(K,4,1);

{KDJ3  原参数}; J:=3*K-2*D;

{浮动线上 取J值}; JJ:=(J/0.005)*MMM;{放在MACD后面};

{浮动线上 画J线}; STICKLINE(J>REF(J,1),YY+REF(JJ,1),YY+JJ,2.0,0),COLORMAGENTA;

{浮动线上 画J线}; STICKLINE(J< REF(J,1),YY+REF(JJ,1),YY+JJ,2.0,0),COLORGREEN;

 

{SAR——————————————————————-};

{SAR 快下抛物线}; SAR1:=IF(CLOSE< SAR(2,3,10),SAR(2,3,10),0);

{SAR 下行抛物线}; SAR2:=IF(CLOSE< SAR(4,2,20),SAR(4,2,20),0);

{SAR 快上抛物线}; SARE:=IF(CLOSE>SAR(3,3,20),SAR(3,3,20),0);

{SAR 上行抛物线}; SARA:=IF(CLOSE>SAR(4,2,10),SAR(4,2,10),0);

{SAR 合画抛物线}; 空仓:IF(MIN(SAR1,SAR2)>0,(SAR1+SAR2)/2,IF(SAR1+SAR2=0,DRAWNULL,SAR1+SAR2)),CIRCLEDOT,COLORGREEN;

{SAR 合画抛物线}; 持股:IF(MIN(SARE,SARA)>0,(SARE+SARA)/2,IF(SARE+SARA=0,DRAWNULL,SARE+SARA)),CIRCLEDOT,COLORMAGENTA;

{MA——————————————————————–};

{MA1  收盘价线}; MA1:C,COLORYELLOW,NODRAW;

{MA3天均线:4K价}; MA3:MA(((3*C+L+O+H)/6),3),COLORYELLOW,NODRAW; 

{MA3上穿SAR提示}; {DRAWICON(CROSS(MA3,SAR(4,2,20))=1,SAR(4,2,20),7);};

{MA3下穿SAR提示}; {DRAWICON(CROSS(SAR(4,2,20),MA3)=1,SAR(4,2,20),8);};

{BBI——————————————————————-};

{BBI   1天线}; BBI:(MA(C,3)+MA(C,6)+MA(C,12)+MA(C,24))/4,COLORWHITE;

{BB5   5天线}; BB5:(MA(C,15)+MA(C,30)+MA(C,60)+MA(C,120))/4,COLORWHITE;

{BB5  上行变红}; IF(C>BB5,BB5,DRAWNULL),COLORRED;

{BB5  下行变蓝}; IF(C< BB5,BB5,DRAWNULL),COLORCYAN;

{重影指示————————————————————–};

{MACD  取高点}; MH:=IF(MACD< 0,-MACD,0);

{MACD  取低点}; ML:=IF(MACD>0,-MACD,0);

{JJ   取高点}; JJH:=IF(REF(JJ,1)>JJ,REF(JJ,1),JJ);

{JJ   取低点}; JJL:=IF(REF(JJ,1)< JJ,REF(JJ,1),JJ);

{重叠区 取高点}; Z1:=IF(JJH>ML AND JJH< MH,JJH,IF(JJH>=MH,MH,DRAWNULL));

{重叠区 取低点}; Z2:=IF(JJL>ML AND JJL< MH,JJL,IF(JJL< =ML,ML,DRAWNULL));

{重叠区 画蓝条}; STICKLINE(0=0,YY+Z1,YY+Z2,0.1,0),COLORBLUE;

{

DRAWTEXT(BACKSET(C>BB5,CURRBARSCOUNT)=1 AND CURRBARSCOUNT=16,IF(CC>MM,LL,HH),'收BB5上,还有好市'),COLORRED;

DRAWTEXT(BACKSET(C< BB5,CURRBARSCOUNT)=1 AND CURRBARSCOUNT=16,IF(CC>MM,LL,HH),'收BB5下,保本要紧'),COLORLIBLUE;

}

DRAWTEXT(CURRBARSCOUNT=16 AND BACKSET(C>BB5,CURRBARSCOUNT)=1 AND BACKSET(CROSS(MA1,BBI)=1,CURRBARSCOUNT)=1,IF(CC>MM,LL,HH),'收BB5上,上穿BBI'),COLORRED;

 

DRAWICON(CROSS(DIF,DEA), YY-MMM,1);

DRAWICON(CROSS(DEA,DIF), YY+MMM,2);

 

通达信指标四合主图源码

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。