分时通道编写缘由:
首先,感谢舍得快乐分享的自动通道源码,此分时通道就是其变化之一。
其次,此通道源码无未来函数,在画线指标中可谓独树一帜。通达信5.84内核
软件在分时界面指标中禁用未来函数,所以可以正常显示。虽然通达信5.85内核
分时界面已经可以运用未来函数,然而基于大多数人对未来函数有所诟病,
褒贬不一,所以更加凸显此通道的实用价值。
再则,指标的运用在于自己,正所谓:运用之妙,存乎一心。适合自己,才是最佳,
为了感谢理想论坛多年的支持,此源码首发于本论坛,
最后,谈点个人看法,本人玩了数年指标,方才悟出大道至简之真谛。曾经编写过
几百个指标,现在大都删除,仅留下二十多个作为看盘辅助之用。也许,日后还会
更少,真正做到知行合一,万法归一。
{分时通道通达信源码}
TT:=BARSCOUNT(C)+1;
M:SUM(V*C,TT)/SUM(V,TT),COLORYELLOW;
DRAWBAND(M,RGB(240,20,240),EMA(M,3),RGB(00,240,0));
P:=240;
TC1:=IF(H=HHV(H,P),C,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UPPER:=CONST(IF(TC2=1,C,REF(C,TC2-1)));
BC1:=IF(L=LLV(L,P),C,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LOWER:=CONST(IF(BC2=1,C,REF(C,BC2-1)));
LP:=CURRBARSCOUNT<=BC2 AND C=LOWER;{低点定位}
HP:=CURRBARSCOUNT<=TC2 AND C=UPPER;{高点定位}
低点:=LOWER;
高点:=UPPER;
TTT:=MAX(TC2,BC2);
ZZ:=(高点+低点)/2;
ZH:=(高点+ZZ)/2;
ZL:=(ZZ+低点)/2;
EE:=CURRBARSCOUNT<=TTT;
IF(EE,ZL,DRAWNULL),COLOR0099FF;
IF(EE,ZH,DRAWNULL),COLORFF9900;
IF(EE,ZZ,DRAWNULL),COLORWHITE;
IF(EE,高点,DRAWNULL),COLOR00FFCC;
IF(EE,低点,DRAWNULL),COLOR00CC00;
STICKLINE(IF(BC2>TC2,HP,LP),低点,高点,0,0),COLOR00FFFF;
STICKLINE(IF(BC2>TC2,LP,HP),低点,高点,0,0),COLOR00FF00;
DRAWNUMBER(EE AND FILTER(C=低点,P),高点,高点),COLORYELLOW;
DRAWNUMBER(EE AND FILTER(C=高点,P),低点,低点),COLOR00FF00;
DRAWNUMBER(EE AND FILTER(C=低点,P),ZH,ZH),COLORFFFF00;
DRAWNUMBER(EE AND FILTER(C=高点,P),ZZ,ZZ),COLORWHITE;
DRAWNUMBER(EE AND FILTER(C=高点,P),ZL,ZL),COLOR0099FF;
NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));{用时}
LR1:=FORCAST(C,NOD+1);
NP:=IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,
REF(LR1,MIN(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLORFF0000;{近点}
LR2:=SLOPE(C,NOD+1);
LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));
FP:=NP-LR3*(NOD),POINTDOT,COLORFF0000;{远点}
EQU:=(NP+FP)/2,POINTDOT,COLOR0000FF;
AD:=ABS(NP-FP);{高差};
DBL:=BARSLAST(BC1!=DRAWNULL)+1;
DBH:=BARSLAST(TC1!=DRAWNULL)+1;
BSP:=IF(BC2>TC2,DBL,DBH)-1;
LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);
AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND H>LRL,H,LRL);
AT2:=HHV(AT1-LRL,MAX(BC2,TC2));
AT3:=CONST(BARSLAST(AT1-LRL=AT2));
AT4:=CONST(IF(AT3=0,H,REF(H,AT3)));
AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));
ATL:=LRL+AT5;
UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L
UT3:=CONST(BARSLAST(LRL-UT1=UT2));
UT4:=CONST(IF(UT3=0,H,REF(H,UT3)));
UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));
UTL:=LRL-UT5;
RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,ATL,CONST(REF(ATL,MIN(BC2,TC2)-11)));{限制高}
RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,UTL,CONST(REF(UTL,MIN(BC2,TC2)-11)));{限制低}
中轨:IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),COLORWHITE;
上轨:IF(NP>FP,IF(ATL<=RH,ATL,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),COLOR00EEFF;
下轨:IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL>=RL,UTL,DRAWNULL)),COLOR00EE00;
DRAWICON(CROSS(C,上轨),上轨,1);
DRAWICON(CROSS(下轨,C),下轨,2);
DRAWNUMBER(ISLASTBAR,上轨,上轨),COLOR00FFFF;
DRAWNUMBER(ISLASTBAR,中轨,中轨),COLORWHITE;
DRAWNUMBER(ISLASTBAR,下轨,下轨),COLOR00FF00;