通达信北沙系列(七):北沙分时矩形(主图公式、说明、附图)
一、公式:
{第一小时}
均价:SUM(V*C,0)/SUM(V,0),COLORYELLOW;
TJ:=TIME=93100;
TS:=BARSLAST(TJ);
TJ2:=TIME=103000;
TS2:=BARSLAST(TJ2);
低点信号1:=IF(BETWEEN(TIME,93100,103000),LLV(L,TS),DRAWNULL)=C;
DT1:=CONST(IF(BARSLAST(FILTERX(低点信号1,TS))>=0,REF(IF(FILTERX(低点信号1,TS),TIME,0),BARSLAST(FILTERX(低点信号1,TS))),
DRAWNULL));
D:=CONST(REF(C,BARSLAST(IF(FILTERX(低点信号1,TS),1,0))));
高点信号1:=IF(BETWEEN(TIME,93100,103000),HHV(C,TS),DRAWNULL)=C;
GT1:=CONST(IF(BARSLAST(FILTERX(高点信号1,TS))>=0,REF(IF(FILTERX(高点信号1,TS),TIME,0),BARSLAST(FILTERX(高点信号1,TS))),
DRAWNULL));
G:=CONST(REF(C,BARSLAST(IF(FILTERX(高点信号1,TS),1,0))));
D1横线:=IF(DYNAINFO(4)<=D,DYNAINFO(4),D);
G1横线:=IF(DYNAINFO(4)>=G,DYNAINFO(4),G);
D1:IF(TS<=59 AND DYNAINFO(4)>0,D1横线,DRAWNULL),COLORLICYAN;
G1:IF(TS<=59 AND DYNAINFO(4)>0,G1横线,DRAWNULL),COLORLICYAN;
STICKLINE(TJ,G1,D1,0,0),COLORLICYAN;
STICKLINE(TIME=103000,G1,D1,0,0),COLORLICYAN;
STICKLINE(BETWEEN(TIME,93100,103000) AND ISLASTBAR,G1,D1,0,0),COLORLICYAN;
天数横线1:=CONST(60);
收盘1大:=CONST(IF(BARSLAST(TIME=103000)>=0 AND REF(C,BARSLAST(TIME=103000))>=DYNAINFO(4),REF(C,BARSLAST(TIME=103000)),0));
收盘1小:=CONST(IF(BARSLAST(TIME=103000)>=0 AND REF(C,BARSLAST(TIME=103000))<DYNAINFO(4),REF(C,BARSLAST(TIME=103000)),0));
IF(收盘1大 AND TIME<=103100,D1+((G1-D1)/天数横线1)*TS,DRAWNULL),COLORRED;
IF(收盘1小 AND TIME<=103100,G1-((G1-D1)/天数横线1)*TS,DRAWNULL),COLORGREEN;
{实时1}
天数横线1实时:=CONST(IF(ISLASTBAR,TS,DRAWNULL));
收盘1实时:=CONST(IF(TS>=0 AND TS<=60,C,DRAWNULL));
开盘1实时:=DYNAINFO(4);
IF(收盘1实时>=开盘1实时 AND TIME<=103100,D1+((G1-D1)/天数横线1实时)*TS,DRAWNULL),COLORRED;
IF(收盘1实时<开盘1实时 AND TIME<=103100,G1-((G1-D1)/天数横线1实时)*TS,DRAWNULL),COLORGREEN;
{第二小时}
TJ3:=TIME=130000;
TS3:=BARSLAST(TJ3);
低点信号2:=IF(BETWEEN(TIME,103000,113000),LLV(L,TS2),DRAWNULL)=C;
DT2:=CONST(IF(BARSLAST(FILTERX(低点信号2,TS2))>=0,REF(IF(FILTERX(低点信号2,TS2),TIME,0),BARSLAST(FILTERX(低点信号2,TS2))),
DRAWNULL));
DD2:=CONST(REF(C,BARSLAST(IF(FILTERX(低点信号2,TS2),1,0))));
高点信号2:=IF(BETWEEN(TIME,103000,113000),HHV(C,TS2),DRAWNULL)=C;
GT2:=CONST(IF(BARSLAST(FILTERX(高点信号2,TS2))>=0,REF(IF(FILTERX(高点信号2,TS2),TIME,0),BARSLAST(FILTERX(高点信号2,TS2))),
DRAWNULL));
GG2:=CONST(REF(C,BARSLAST(IF(FILTERX(高点信号2,TS2),1,0))));
D2:IF(TS<=119 AND TS2>=0,DD2,DRAWNULL),COLORLICYAN;
G2:IF(TS<=119 AND TS2>=0,GG2,DRAWNULL),COLORLICYAN;
STICKLINE(TJ2,GG2,DD2,0,0),COLORLICYAN;
STICKLINE(TIME=130000,GG2,DD2,0,0),COLORLICYAN;
STICKLINE(BETWEEN(TIME,103000,113000) AND ISLASTBAR,G2,D2,0,0),COLORLICYAN;
收1:=CONST(IF(BARSLAST(TIME=112900)>=0,REF(C,TS2),0));
午收:=CONST(IF(BARSLAST(TIME=112900)>=0,REF(C,BARSLAST(TIME=112900)),0));
IF(午收>=收1 AND TIME<=113000,D2+((G2-D2)/天数横线1)*TS2,DRAWNULL),COLORRED;
IF(午收<收1 AND TIME<=113000,G2-((G2-D2)/天数横线1)*TS2,DRAWNULL),COLORGREEN;
{实时2}
天数横线2实时:=CONST(IF(ISLASTBAR,TS2,DRAWNULL));
收盘2实时:=CONST(IF(TS2>=0 AND TS2<=60,C,DRAWNULL));
开盘2实时:=CONST(IF(TS2>=0,REF(C,TS2),0));
IF(收盘2实时>=开盘2实时 AND TIME<=113000,D2+((G2-D2)/天数横线2实时)*TS2,DRAWNULL),COLORRED;
IF(收盘2实时<开盘2实时 AND TIME<=113000,G2-((G2-D2)/天数横线2实时)*TS2,DRAWNULL),COLORGREEN;
{第三小时}
低点信号3:=IF(BETWEEN(TIME,113000,140000),LLV(L,TS3),DRAWNULL)=C;
DT3:=CONST(IF(BARSLAST(FILTERX(低点信号3,TS3))>=0,REF(IF(FILTERX(低点信号3,TS3),TIME,0),BARSLAST(FILTERX(低点信号3,TS3))),
DRAWNULL));
DD3:=CONST(REF(C,BARSLAST(IF(FILTERX(低点信号3,TS3),1,0))));
高点信号3:=IF(BETWEEN(TIME,113000,140000),HHV(C,TS3),DRAWNULL)=C;
GT3:=CONST(IF(BARSLAST(FILTERX(高点信号3,TS3))>=0,REF(IF(FILTERX(高点信号3,TS3),TIME,0),BARSLAST(FILTERX(高点信号3,TS3))),
DRAWNULL));
GG3:=CONST(REF(C,BARSLAST(IF(FILTERX(高点信号3,TS3),1,0))));
D3:IF(TS<=179 AND TS3>=0,DD3,DRAWNULL),COLORLICYAN;
G3:IF(TS<=179 AND TS3>=0,GG3,DRAWNULL),COLORLICYAN;
STICKLINE(TJ3,GG3,DD3,0,0),COLORLICYAN;
STICKLINE(TIME=140000,GG3,DD3,0,0),COLORLICYAN;
STICKLINE(BETWEEN(TIME,130000,140000) AND ISLASTBAR,G3,D3,0,0),COLORLICYAN;
收2:=CONST(IF(BARSLAST(TIME=130000)>=0,REF(C,TS3),0));
收3:=CONST(IF(BARSLAST(TIME=135900)>=0,REF(C,BARSLAST(TIME=135900)),0));
IF(收3>=收2 AND TIME<=135900,D3+((G3-D3)/天数横线1)*TS3,DRAWNULL),COLORRED;
IF(收3<收2 AND TIME<=135900,G3-((G3-D3)/天数横线1)*TS3,DRAWNULL),COLORGREEN;
{实时3}
天数横线3实时:=CONST(IF(ISLASTBAR,TS3,DRAWNULL));
收盘3实时:=CONST(IF(TS3>=0 AND TS3<=60,C,DRAWNULL));
开盘3实时:=CONST(IF(TS3>=0,REF(C,TS3),0));
IF(收盘3实时>=开盘3实时 AND TIME<=140000,D3+((G3-D3)/天数横线3实时)*TS3,DRAWNULL),COLORRED;
IF(收盘3实时<开盘3实时 AND TIME<=140000,G3-((G3-D3)/天数横线3实时)*TS3,DRAWNULL),COLORGREEN;
{第四小时}
TJ4:=TIME=140000;
TS4:=BARSLAST(TJ4);
低点信号4:=IF(TS4>=0,LLV(L,TS4),DRAWNULL)=C;
DT4:=CONST(IF(BARSLAST(FILTERX(低点信号4,TS4))>=0,REF(IF(FILTERX(低点信号4,TS4),TIME,0),BARSLAST(FILTERX(低点信号4,TS4))),
DRAWNULL));
DD4:=CONST(REF(C,BARSLAST(IF(FILTERX(低点信号4,TS4),1,0))));
高点信号4:=IF(TS4>=0,HHV(C,TS4),DRAWNULL)=C;
GG4:=CONST(REF(C,BARSLAST(IF(FILTERX(高点信号4,TS4),1,0))));
GT4:=CONST(IF(BARSLAST(FILTERX(高点信号4,TS4))>=0,REF(IF(FILTERX(高点信号4,TS4),TIME,0),BARSLAST(FILTERX(高点信号4,TS4))),
DRAWNULL));
D4:IF(TS4>=0,DD4,DRAWNULL),COLORLICYAN;
G4:IF(TS4>=0,GG4,DRAWNULL),COLORLICYAN;
STICKLINE(TJ4,GG4,DD4,0,0),COLORLICYAN;
STICKLINE(TS4>=0 AND ISLASTBAR,GG4,DD4,0,0),COLORLICYAN;
收4:=CONST(IF(BARSLAST(TIME=140000)>=0,REF(C,TS4),0));
收5:=DYNAINFO(7);
天数横线4:=CONST(TS4);
IF(收5>=收4 AND TIME<=145900,D4+((G4-D4)/天数横线4)*TS4,DRAWNULL),COLORRED;
IF(收5<收4 AND TIME<=145900,G4-((G4-D4)/天数横线4)*TS4,DRAWNULL),COLORGREEN;
DRAWTEXT(TIME=93100 AND GT1>DT1,G1*0.997,'【涨幅】: ﹪'),COLORMAGENTA;
DRAWNUMBER(GT1>DT1 AND TIME=94500,G1*0.997,(D1-G1)/G1*100),COLORMAGENTA;
DRAWTEXT(TIME=93100 AND GT1<DT1,D1*1.003,'【跌幅】: ﹪'),COLORGREEN;
DRAWNUMBER(GT1<DT1 AND TIME=94500,D1*1.003,(D1-G1)/G1*100),COLORGREEN;
DRAWTEXT(TIME=103100 AND GT2>DT2,G2*0.997,'【涨幅】: ﹪'),COLORMAGENTA;
DRAWNUMBER(GT2>DT2 AND TIME=104500,G2*0.997,(D2-G2)/G2*100),COLORMAGENTA;
DRAWTEXT(TIME=103100 AND GT2<DT2,D2*1.003,'【跌幅】: ﹪'),COLORGREEN;
DRAWNUMBER(GT2<DT2 AND TIME=104500,D2*1.003,(D2-G2)/G2*100),COLORGREEN;
DRAWTEXT(TIME=130100 AND GT3>DT3,G3*0.997,'【涨幅】: ﹪'),COLORMAGENTA;
DRAWNUMBER(GT3>DT3 AND TIME=131500,G3*0.997,(D3-G3)/G3*100),COLORMAGENTA;
DRAWTEXT(TIME=130100 AND GT3<DT3,D3*1.003,'【跌幅】: ﹪'),COLORGREEN;
DRAWNUMBER(GT3<DT3 AND TIME=131500,D3*1.003,(D3-G3)/G3*100),COLORGREEN;
DRAWTEXT(TIME=140100 AND GT4>DT4,G4*0.997,'【涨幅】: ﹪'),COLORMAGENTA;
DRAWNUMBER(GT4>DT4 AND TIME=141500,G4*0.997,(D4-G4)/G4*100),COLORMAGENTA;
DRAWTEXT(TIME=140100 AND GT4<DT4,D4*1.003,'【跌幅】: ﹪'),COLORGREEN;
DRAWNUMBER(GT4<DT4 AND TIME=141500,D4*1.003,(D4-G4)/G4*100),COLORGREEN;
D11:=YEAR AND MONTH AND DAY;
AA1:=STRCAT(CON2STR(YEAR,0),'年');
AA2:=STRCAT(CON2STR(MONTH,0),'月');
AA3:=STRCAT(CON2STR(DAY,0),'日');
AA4:=STRCAT('【',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))));
AA:=STRCAT(STRCAT(STRCAT(AA1,AA2),STRCAT(AA3,AA4)),'】');
DRAWTEXT_FIX(D11,0,1,0,AA),COLORGREEN;
二、说明
1、本公式适用于有条件盯盘的股民使用;
2、本公式适用于盘中T+0交易;
3、本公式的重点是试图描述分时走势中的波段运动;
4、本公式与北沙分时互为补充、使用中注意结合;
5、分时T+0交易为高级技术、建议大家自己总结更靠谱一些;
三、鸣谢
感谢北沙老师的辛苦付出、使得北沙公式基本构成完整的系列
经过近一年的市场检验、实用性如何、相信大家心中自有定论
下面是今天的上证指数信号提示: