以下是通达信空间与时间及压力与支撑源码主图

思路源于冷妞妞老师的灾后自救 及飞远国际的MACD体现在K线上
仅做参考用 理解运用适合自己是最好的
 

建一个引用 
{DP}
HH:=IF(BETWEEN(DATE,1150601,1150630),H,-999);
LL:=IF(BETWEEN(DATE,1150709,1150709),L,-999);
T:=HHVBARS(HH,0);
TL:=HHVBARS(LL,0);
GWJ:DRAWLINE(CURRBARSCOUNT=CONST(T)+1,HH,ISLASTBAR,REF(HH,T),0),COLORYELLOW;
DWJ:DRAWLINE(CURRBARSCOUNT=CONST(TL)+1,LL,ISLASTBAR,REF(LL,TL),0),COLOR00DD00;
DC:C;

{空间与时间及压力与支撑}
{参数;D 0  5  0}
GDZQ:=CONST(BARSLAST(CURRBARSCOUNT =1))+1;
HH:=IF(GDZQ,H,-999);
LL:=IF(GDZQ,L,-999);
T:=HHVBARS(HH,0);
TTD:=BARSLAST(L=LLV(L,T+1));
T1:=BARSLAST(CURRBARSCOUNT=CONST(TTD)+1);
XL:=REFX(MIN(C,O),BARSNEXT(T1=0)),COLORGREEN;
高位价:DRAWLINE(CURRBARSCOUNT=CONST(T)+1,HH,ISLASTBAR,REF(HH,T),0),COLORYELLOW;
低位价:DRAWLINE(CURRBARSCOUNT=CONST(T1)+1,LL,ISLASTBAR,REF(LL,T1),0),COLOR00FF00;
YY:=高位价-低位价;
底点到高点:=YY/高位价*100;
YYY:=STRCAT(‘ 高位价到低位价幅度:- ‘,CON2STR(底点到高点,0));
DRAWTEXT_FIX(ISLASTBAR,0.01,0.2,0,YYY),COLOR00DD00;
DRAWTEXT_FIX(ISLASTBAR,0.15,0.2,0,’ %’),COLORFFCC99;
YX:=C-低位价;YYX:=YX/低位价*100;
YYYX:=STRCAT(‘ 近期低点到当前幅度: ‘,CON2STR(YYX,0));
DRAWTEXT_FIX(ISLASTBAR,0.01,0.25,0,YYYX),COLOREE99EE;
DRAWTEXT_FIX(ISLASTBAR,0.141,0.25,0,’ %’),COLOREEAAEE;
高点周期:=CONST(T);
底点周期:=CONST(T1);{
底点周期:=CONST(BARSLAST(T1))+1;}
高底点周期:=ABS(高点周期-底点周期);
高点到当前:=STRCAT(‘ 高点到当前周期: ‘,CON2STR(高点周期,0));
底点到当前:=STRCAT(‘ 底点到当前周期: ‘,CON2STR(底点周期,0));
高底点周期A:=STRCAT(‘ 高点到底点周期: ‘,CON2STR(高底点周期,0));
DRAWTEXT_FIX(ISLASTBAR,0.01,0.4,0,高点到当前),COLOREEAAEE;
DRAWTEXT_FIX(ISLASTBAR,0.12,0.4,0,’ 天’),COLORFFCC99;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.35,0,底点到当前),COLOR00EEEE;
DRAWTEXT_FIX(ISLASTBAR,0.12,0.35,0,’ 天’),COLORFFCC99;
DRAWTEXT_FIX(ISLASTBAR,0.01,0.3,0,高底点周期A),COLOR00DD00;
DRAWTEXT_FIX(ISLASTBAR,0.12,0.3,0,’ 天’),COLORFFCC99;
HD:=CALCSTOCKINDEX(‘999999′,’DP’,1);
LD:=CALCSTOCKINDEX(‘999999′,’DP’,2);
CD:=CALCSTOCKINDEX(‘999999′,’DP’,3);
YYD:=HD-LD;
底点到高点D:=YYD/HD*100;
YYYD:=STRCAT(‘大盘 高位价到低位价幅度:- ‘,CON2STR(底点到高点D,0));
DRAWTEXT_FIX(ISLASTBAR,0.01,0.05,0,YYYD),COLOR00DD00;
DRAWTEXT_FIX(ISLASTBAR,0.17,0.05,0,’ %’),COLORFFCC99;
YXD:=CD-LD;YYXD:=YXD/LD*100;
YYYXD:=STRCAT(‘大盘 近期低点到当前幅度: ‘,CON2STR(YYXD,0));
DRAWTEXT_FIX(ISLASTBAR,0.01,0.1,0,YYYXD),COLOREE99EE;
DRAWTEXT_FIX(ISLASTBAR,0.165,0.1,0,’ %’),COLOREEAAEE;
高价AX:=IF(高位价 AND D>=1,高位价*0.92,DRAWNULL);
高价BX:=IF(高位价 AND D>=1,高位价*0.87,DRAWNULL);
高价CX:=IF(高位价 AND D>=2,高位价*0.80,DRAWNULL);
高价DX:=IF(高位价 AND D>=2,高位价*0.75,DRAWNULL);
高价EX:=IF(高位价 AND D>=3,高位价*0.67,DRAWNULL);
高价FX:=IF(高位价 AND D>=3,高位价*0.63,DRAWNULL);
高价GX:=IF(高位价 AND D>=4,高位价*0.55,DRAWNULL);
高价HX:=IF(高位价 AND D>=4,高位价*0.50,DRAWNULL);
高价LX:=IF(高位价 AND D>=5,高位价*0.38,DRAWNULL);
高价SX:=IF(高位价 AND D>=5,高位价*0.33,DRAWNULL);
DRAWBAND(高位价,RGB(55,55,55),高价AX,RGB(0,0,0));
DRAWBAND(高价AX,RGB(91,164,161),高价BX,RGB(91,164,161));
DRAWBAND(高价BX,RGB(66,66,66),高价CX,RGB(0,0,0));
DRAWBAND(高价CX,RGB(95,159,130),高价DX,RGB(95,159,130));
DRAWBAND(高价DX,RGB(77,77,77),高价EX,RGB(0,0,0));
DRAWBAND(高价EX,RGB(107,100,152),高价FX,RGB(107,100,152));
DRAWBAND(高价FX,RGB(88,88,88),高价GX,RGB(0,0,0));
DRAWBAND(高价GX,RGB(124,92,159),高价HX,RGB(124,92,159));
DRAWBAND(高价LX,RGB(99,99,99),高价HX,RGB(99,99,99));
DRAWBAND(高价LX,RGB(165,92,131),高价SX,RGB(165,92,131));
低价A:=IF(低位价 AND D>=1,低位价*1.08,DRAWNULL);
低价B:=IF(低位价 AND D>=1,低位价*1.12,DRAWNULL);
低价C:=IF(低位价 AND D>=2,低位价*1.20,DRAWNULL);
低价D:=IF(低位价 AND D>=2,低位价*1.25,DRAWNULL);
低价E:=IF(低位价 AND D>=3,低位价*1.33,DRAWNULL);
低价F:=IF(低位价 AND D>=3,低位价*1.37,DRAWNULL);
低价G:=IF(低位价 AND D>=4,低位价*1.45,DRAWNULL);
低价H:=IF(低位价 AND D>=4,低位价*1.50,DRAWNULL);
低价K:=IF(低位价 AND D>=5,低位价*1.62,DRAWNULL);
低价L:=IF(低位价 AND D>=5,低位价*1.67,DRAWNULL);
DRAWBAND(低位价,RGB(161,94,151),低价A,RGB(161,94,151));
DRAWBAND(低价A,RGB(177,155,77),低价B,RGB(177,155,77));
DRAWBAND(低价B,RGB(159,95,149),低价C,RGB(159,95,149));
DRAWBAND(低价C,RGB(214,176,39),低价D,RGB(214,176,39));
DRAWBAND(低价D,RGB(162,92,160),低价E,RGB(162,92,160));
DRAWBAND(低价E,RGB(221,180,32),低价F,RGB(221,180,32));
DRAWBAND(低价F,RGB(169,85,162),低价G,RGB(169,85,162));
DRAWBAND(低价H,RGB(188,169,64),低价G,RGB(188,169,64));
DRAWBAND(低价K,RGB(114,72,179),低价H,RGB(0,0,0));
DRAWBAND(低价K,RGB(179,199,61),低价L,RGB(179,199,61));
DRAWTEXT(ISLASTBAR AND D>=1,低价A,’8%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=1,低价B,’12%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=2,低价C,’20%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=2,低价D,’25%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=3,低价E,’33%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=3,低价F,’37%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=4,低价G,’45%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=4,低价H,’50%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=5,低价K,’62%’),COLOR208FFF;
DRAWTEXT(ISLASTBAR AND D>=5,低价L,’67%’),COLOR208FFF;
DRAWKLINE(H,O,L,C);
AS:=(O+H+L+C)/4;
SYA:EMA(AS,5),LINETHICK1,COLORFFFFFF;
SYAA:EMA(AS,10),LINETHICK1,COLOR00FFFF;
SYAB:EMA(AS,55),LINETHICK1,COLOR208FFF;
SYAC:EMA(AS,20),LINETHICK1,COLOREE99EE;
SYAD:EMA(AS,120),LINETHICK1,COLOREEEE00;
DIF:=EMA(CLOSE,3)-EMA(CLOSE,7),COLOR00FFFF;
DEA:=EMA(DIF,3);
DRAWICON(CROSS(DIF,DEA) AND DIF>0,L,29);
DRAWICON(CROSS(DEA,DIF) AND DIF>0,H,37);
DRAWICON(CROSS(DIF,DEA) AND DIF<0,L,1);
{
添加到参数精灵里

调整D: Param#0 1–5显示幅度压力与支撑}

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