通达信开心主图指标(源码)
HDAY:=15;
LDAY:=15;
PE:=1;
KE:=3;
CURR:=CURRBARSCOUNT;
TCH:=CONST(FINDHIGH(H,0,HDAY*10,1));
GTT:=CONST(BARSLAST(TCH=H))+1;
SX跌H:=CONST(IF(GTT=1,H,REF(H,GTT-1)));
BCL:=CONST(FINDLOW(L,0,LDAY*10,1));
DTT:=CONST(BARSLAST(BCL=L))+1;
SX涨L:=CONST(IF(DTT=1,L,REF(L,DTT-1)));
IM68:=((SX跌H-SX涨L)/6-(SX跌H-SX涨L)/8);
GH跌X:=SX跌H+(SX跌H-SX涨L)/8; DL涨X:=SX涨L-(SX跌H-SX涨L)/8;
STICKLINE(1=1,H,L,9,0)COLOR000000;
GTHT:=IF(DTT>GTT,DTT,GTT); R:=ABS(GTT-DTT);
DRAWBAND(IF(CURR<=GTHT+R/8,GH跌X,DRAWNULL),RGB(80,124,124),DL涨X,RGB(80,124,124));
DRAWBAND(IF(CURR<=GTHT+R/8,SX跌H,DRAWNULL),RGB(8,168,168),SX跌H,RGB(8,168,168));
DRAWBAND(IF(CURR<=GTHT+R/8,SX涨L,DRAWNULL),RGB(8,168,168),SX涨L,RGB(8,168,168));
DRAWBAND(IF(CURR<=GTHT+R/8,SX跌H-(SX跌H-SX涨L)/8,DRAWNULL),RGB(80,124,24),SX涨L+(SX跌H-SX涨L)/8,RGB(80,124,24));
DRAWBAND(IF(CURR<=GTHT+R/8,SX跌H-(SX跌H-SX涨L)/4,DRAWNULL),RGB(0,124,154),SX涨L+(SX跌H-SX涨L)/4,RGB(0,124,154));
DRAWBAND(IF(CURR<=GTHT+R/8,SX跌H-(SX跌H-SX涨L)*3/8,DRAWNULL),RGB(80,124,24),SX涨L+(SX跌H-SX涨L)*3/8,RGB(80,124,24));
DRAWBAND(IF(CURR<=GTHT+R/8,(SX跌H+SX涨L)/2,DRAWNULL),RGB(8,168,168),(SX跌H+SX涨L)/2,RGB(8,168,168));
DRAWTEXT(CURR=GTHT,SX涨L-IM68,' 开心?果?'),COLOR8899AA;
SX涨:=(CURR=KE+DTT)-1;
SX跌:=(CURR=KE+GTT)-1;
SX涨跌:=DRAWLINE(SX涨=0,SX涨L,SX跌=0,SX跌H,0);
SX跌涨:=DRAWLINE(SX涨=0,SX跌H,SX跌=0,SX涨L,0);
S涨跌X:=DRAWLINE(SX跌=0,SX跌H,SX涨=0,SX涨L,0);
S跌涨X:=DRAWLINE(SX跌=0,SX涨L,SX涨=0,SX跌H,0);
SX涨跌X:=IF(DTT>GTT,SX涨跌,S涨跌X);
SX跌涨X:=IF(DTT>GTT,SX跌涨,S跌涨X);
PEDAY:=IF(PE=1,0,IF(PE=2,R/2,IF(PE=3,R,IF(PE=4,R+R/2,IF(PE=5,2*R,IF(PE=6,2*R+R/2,IF(PE=7,3*R,3*R+R/2)))))));
SLXH:IF(BETWEEN(CURR,KE+DTT-PEDAY,KE+GTT-PEDAY),(SX跌H+SX涨L)/2,DRAWNULL),COLOR8E0000,LINETHICK3;
H跌X:IF(BETWEEN(CURR,KE+DTT-PEDAY,KE+GTT-PEDAY),SX跌H,DRAWNULL),COLOR8E0000,LINETHICK3;
L涨X:IF(BETWEEN(CURR,KE+DTT-PEDAY,KE+GTT-PEDAY),SX涨L,DRAWNULL),COLOR8E0000,LINETHICK3;
STICKLINE(REF(SX涨=0,PEDAY) OR REF(SX跌=0,PEDAY) OR REF(CURR=KE+ROUND((GTT+DTT)/2),PEDAY),SX跌H,SX涨L,0.1,0),COLOR8E0000;
X涨点:=IF(SX涨>SX跌,SX涨,SX跌);
X跌点:=IF(SX涨>SX跌,SX涨,SX跌);
开心1:REF(DRAWLINE(X跌点=0,SX跌H,CURR=KE+ROUND((GTT+DTT)/2),SX涨L,0),PEDAY),COLOR00FFFF;
开心2:REF(DRAWLINE(X跌点=0,(SX跌H+SX涨L)/2,CURR=KE+ROUND((GTT+DTT)/2),SX涨L,0),PEDAY),COLORFF0000,LINETHICK2;
开心3:REF(DRAWLINE(X跌点=0,SX涨L,CURR=KE+ROUND((GTT+DTT)/2),SX跌H,0),PEDAY),COLOR00FFFF;
开心4:REF(DRAWLINE(X跌点=0,SX跌H,X涨点=0,(SX跌H+SX涨L)/2,0),PEDAY),COLOR00FFFF;
开心5:REF(DRAWLINE(X跌点=0,SX涨L,X涨点=0,(SX跌H+SX涨L)/2,0),PEDAY),COLOR00FFFF;
开心6:REF(DRAWLINE(X跌点=0,(SX跌H+SX涨L)/2,CURR=KE+ROUND((GTT+DTT)/2),SX跌H,0),PEDAY),COLORFF0000,LINETHICK2;
开心7:REF(DRAWLINE(X跌点=0,(SX跌H+SX涨L)/2,X涨点=0,SX跌H,0),PEDAY),COLOR00FFFF;
开心8:REF(DRAWLINE(X跌点=0,(SX跌H+SX涨L)/2,X涨点=0,SX涨L,0),PEDAY),COLOR00FFFF;
开心9:REF(DRAWLINE(CURR=KE+ROUND((GTT+DTT)/2),SX涨L,X涨点=0,(SX跌H+SX涨L)/2,0),PEDAY),COLORFF0000,LINETHICK2;
开心10:REF(DRAWLINE(CURR=KE+ROUND((GTT+DTT)/2),SX跌H,X涨点=0,(SX跌H+SX涨L)/2,0),PEDAY),COLORFF0000,LINETHICK2;
开心11:REF(DRAWLINE(CURR=KE+ROUND((GTT+DTT)/2),SX跌H,X涨点=0,SX涨L,0),PEDAY),COLOR00FFFF;
开心12:REF(DRAWLINE(CURR=KE+ROUND((GTT+DTT)/2),SX涨L,X涨点=0,SX跌H,0),PEDAY),COLOR00FFFF;
开心13:REF(SX涨跌X,PEDAY),COLOR8E00E8;
开心14:REF(SX跌涨X,PEDAY),COLOR8E00E8;
IF(BETWEEN(CURR,KE+DTT,KE+GTT),SX跌H,DRAWNULL),COLOR8E0000,LINETHICK3;
IF(BETWEEN(CURR,KE+DTT,KE+GTT),SX涨L,DRAWNULL),COLOR8E0000,LINETHICK3;
STICKLINE(SX涨=0 OR SX跌=0,SX跌H,SX涨L,0.1,0),COLOR8E0000;
DRAWTEXT(CURR=KE+ROUND((GTT+DTT)/2)+5,SX跌H*0.98,'历史区间'),COLOR8800AA;
DRAWKLINE(IF(CURR>KE,REFX(H,KE),DRAWNULL),IF(CURR>KE,REFX(O,KE),DRAWNULL),
IF(CURR>KE,REFX(L,KE),DRAWNULL),IF(CURR>KE,REFX(C,KE),DRAWNULL));
- 上一篇公式:通达信红龙主图指标(源码)
- 下一篇公式:通达信约好逃顶主图指标(源码)