通达信量价背离决策源码:
DRAWGBK(C>0, RGB(50,0,50),RGB(30,0,120),0,0,1);
中:50,COLORYELLOW;
VAR1中:=LLV(LOW,13);
VAR2:=HHV(HIGH,13);
VAR3:=SMA((CLOSE-VAR1中)/(VAR2-VAR1中)*100,5,1);
VAR4:=SMA((VAR2-CLOSE)/(VAR2-VAR1中)*100,5,1);
DRAWBAND(VAR3,RGB(115,30,150),50,RGB(0,100,100));
主力:VAR3,COLORLIRED,LINETHICK1;
散户:VAR4,COLORGREEN;
VAR5:=SMA(MAX(CLOSE-REF(CLOSE,1),0),5,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),5,1)*100;
操作:EMA(VAR5,3),LINETHICK1,COLORYELLOW;
{操作变色:IF(操作>REF(操作,1),操作,DRAWNULL),LINETHICK2,COLORMAGENTA;}
STICKLINE(C,90,90,1,0),COLOR3C3CFF;
STICKLINE(C,50,50,1,0),COLORYELLOW;
STICKLINE(C,10,10,1,0),COLORCYAN;
DRAWICON(CROSS(操作,中),中,34);{买入红箭头};
DRAWTEXT(CROSS(操作,中),中-0.1,' '),COLORYELLOW;
N1:=9;N2:=5;N:=21;
XIAO1:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);
XIAO2:=SMA(ABS(LOW-XIAO1),13,1)/SMA(MAX(LOW-XIAO1,0),10,1);
XIAO3:=EMA(XIAO2,10);
XIAO4:=LLV(LOW,33);
XIAO5:=EMA(IF(LOW<=XIAO4,XIAO3,0),3),COLORSTICK;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,3,0 ),COLOR000055;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,2.6,0 ),COLOR000077;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,2.1,0 ),COLOR000099;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,1.5,0 ),COLOR0000BB;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,0.9,0 ),COLOR0000DD;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,0.3,0 ),COLOR0000FF;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,3,0),COLOR005500;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,2.6,0),COLOR007700;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,2.1,0),COLOR009900;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,1.5,0),COLOR00BB00;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,0.9,0),COLOR00DD00;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,0.3,0),COLOR00FF00;
【私募进场】:IF(XIAO5>REF(XIAO5,1),XIAO5,0),COLORRED,NODRAW;
【私募洗盘】:IF(XIAO5<REF(XIAO5,1),XIAO5,0),COLORGREEN,NODRAW;
B1:=(HHV(H,9)-C)/(HHV(H,9)-LLV(LOW,9))*100- 70;
B2:=SMA(B1,9,1)+100;
B3:=(C-LLV(L,9))/(HHV(H,9)- LLV(L,9))*100;
B4:=SMA(B3,3,1);
B5:=SMA(B4,3,1)+100;
B6:=B5-B2;
观望期:=IF(B6>60,B6-60,0);
T1:=STICKLINE(REF(观望期,1)<观望期,观望期,REF(观望期,1),9,0),COLORYELLOW;
T2:=STICKLINE(REF(观望期,1)>观望期,观望期,REF(观望期,1),9,0),COLORCYAN;{趋势背景}
TAI1:=MA(C,1)/MA(REF(C,13),8)*100;
TAI2:=MA(FORCAST(TAI1,21),3);
TAI3:=REF(TAI1,1);
TAI4:=REF(TAI1,2);
邰1:=LLV(LOW,8);
邰2:=HHV(HIGH,13);
#股市黑客#:= EMA((CLOSE-邰1)/(邰2-邰1)*100,5),COLORRED,LINETHICK3;{输出后是趋势背景}
※升跌临界※:= EMA(0.667*REF(#股市黑客#,1)+0.333*#股市黑客#,2),COLORGREEN,LINETHICK3;{输出后是趋势背景}
VAR1:=(CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2));
VARD:=(CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2));
VARE:=(REF(VARD,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VARF:=(REF(VARE,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR10:=(REF(VARF,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR11:=(REF(VAR10,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR12:=(REF(VAR11,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR13:=(REF(VAR12,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR14:=(REF(VAR13,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR15:=(REF(VAR14,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR16:=(REF(VAR15,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR17:=(REF(VAR16,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR18:=(REF(VAR17,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR19:=REF(VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18,1) AND VAR1;
DIFF:=EMA(DCLOSE,12)-EMA(DCLOSE,26);
DEA:=EMA(DIFF,9),COLORFFFF00;
MACD:=(DIFF-DEA)*2,COLORSTICK;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
¥①:IF(REF((MA(C,5)-C)/C>0.04 AND (MA(C,10)-MA(C,5))/MA(C,5)>0.04 AND 观望期=0 AND C>REF(C,1),1),44,0),LINETHICK3,COLORLIRED;{进}
¥②:IF(REF("KDJ.J",1)<0 AND "KDJ.J">0 AND TAI1>=TAI2 AND TAI3>TAI4,34,0),LINETHICK3,COLORBROWN;{进}
¥③:IF(REF(#股市黑客#,1)<=13&&CROSS(#股市黑客#,※升跌临界※)&& REF(MA(C,55),1)>REF(MA(C,55),2)&&(VAR19 OR REF(VAR19,1)),33,0),COLORMAGENTA,LINETHICK3;
¥④:IF(底背离,45,0),LINETHICK3,COLORYELLOW;
DRAWTEXT(底背离,37,'←¥④MACD底背离'),COLORWHITE;
DRAWICON(底背离,45,1),COLORYELLOW;
DRAWICON(REF(#股市黑客#,1)<=13&&CROSS(#股市黑客#,※升跌临界※)&& REF(MA(C,55),1)>REF(MA(C,55),2)&&(VAR19 OR REF(VAR19,1)),35,1);
DRAWICON(REF((MA(C,5)-C)/C>0.04 AND (MA(C,10)-MA(C,5))/MA(C,5)>0.04 AND 观望期=0 AND C>REF(C,1),1),46,1);
DRAWICON(REF("KDJ.J",1)<0 AND "KDJ.J">0 AND TAI1>=TAI2 AND TAI3>TAI4,36,1),COLORYELLOW;
{DRAWTEXT_FIX(C>O,0.01,0.9,0,'WWW.CXH99.COM'),COLORRED;
DRAWTEXT_FIX(C>O,1,1,0,'程序化交易模型'),COLORRED;};
DRAWTEXT(REF(#股市黑客#,1)<=13&&CROSS(#股市黑客#,※升跌临界※)&& REF(MA(C,55),1)>REF(MA(C,55),2)&&(VAR19 OR REF(VAR19,1)),28,'←¥③背离临界'),COLORMAGENTA;
DRAWTEXT(REF("KDJ.J",1)<0 AND "KDJ.J">0 AND TAI1>=TAI2 AND TAI3>TAI4,32,'←¥②KDJ背离'),COLORBROWN;
DRAWTEXT(REF((MA(C,5)-C)/C>0.04 AND (MA(C,10)-MA(C,5))/MA(C,5)>0.04 AND 观望期=0 AND C>REF(C,1),1),37,'←¥①背离中'),COLORLIRED;
主力成本:EMA(MA(CLOSE,3),13),NODRAW,COLORAAAAFF;
短期支撑:LLV(HIGH,30),NODRAW,COLORAAAAFF;
换手率:VOL/CAPITAL*100,NODRAW,COLORFF8888;
五日均换手率:SUM(100*V/CAPITAL,5)/5,NODRAW,COLORAAAAFF;
十日均换手率:SUM(100*V/CAPITAL,10)/10,NODRAW,COLORAAAAFF;
量:=IF(C>200,VOL/1000000,VOL/1),LINETHICK0,COLOREEEEFF;
地量:=换手率<1,COLORFF6600;
低靡:=C=C AND 换手率>=1 AND 换手率<2,COLOR008364;
温和:=C=C AND 换手率>=2 AND 换手率<3,COLORFFFFFF;
活跃:=C=C AND 换手率>=3 AND 换手率<5,COLOR208FFF;
带量:=C=C AND 换手率>=5 AND 换手率<8,COLORYELLOW;
放量:=C=C AND 换手率>=8 AND 换手率<15,COLORFF00FF;
巨量:=C=C AND 换手率>=15 AND 换手率<25,COLORRED;
怪异:=C=C AND 换手率>=25,COLORE66878;
{地量 AND ISLASTBAR AND PERIOD=5,60,'成交地量'}
DRAWTEXT_FIX(地量 AND ISLASTBAR AND PERIOD=5, 0.28,0.10,0,'成交地量'),COLORGREEN;
DRAWTEXT_FIX(低靡 AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交低靡'),COLORCYAN;
DRAWTEXT_FIX(温和 AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交温和'),COLORFFFFFF;
DRAWTEXT_FIX(活跃 AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交活跃'),COLOR208FFF;
DRAWTEXT_FIX(带量 AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交带量'),COLORYELLOW;
DRAWTEXT_FIX(放量 AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交放量'),COLORFF00FF;
DRAWTEXT_FIX(巨量 AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交巨量'),COLORRED;
DRAWTEXT_FIX(怪异 AND ISLASTBAR AND PERIOD=5,0.28,0.10,0,'成交怪异'),COLORE66878;
VVOL:=IF(CURRBARSCOUNT=1 AND PERIOD=5,VOL*240/FROMOPEN,DRAWNULL),NODRAW;
V换手率:=VVOL/CAPITAL*100,NODRAW,COLORYELLOW;
{V量:=IF(C>200,VOL/1000000,VOL/1),LINETHICK0,COLOREEEEFF;}
V地量:=V换手率<1,COLORFF6600;
V低靡:=C=C AND V换手率>=1 AND V换手率<2,COLOR008364;
V温和:=C=C AND V换手率>=2 AND V换手率<3,COLORFFFFFF;
V活跃:=C=C AND V换手率>=3 AND V换手率<5,COLOR208FFF;
V带量:=C=C AND V换手率>=5 AND V换手率<8,COLORYELLOW;
V放量:=C=C AND V换手率>=8 AND V换手率<15,COLORFF00FF;
V巨量:=C=C AND V换手率>=15 AND V换手率<25,COLORRED;
V怪异:=C=C AND V换手率>=25,COLORE66878;
DRAWTEXT_FIX(V地量 AND ISLASTBAR AND FROMOPEN<240 AND FROMOPEN>5, 0.7,0.10,0,'预测地量'),COLORFF6600;
DRAWTEXT_FIX(V低靡 AND ISLASTBAR AND FROMOPEN<240 AND FROMOPEN>5,0.7,0.10,0,'预测低靡'),COLOR008364;
DRAWTEXT_FIX(V温和 AND ISLASTBAR AND FROMOPEN<240 AND FROMOPEN>5,0.7,0.10,0,'预测温和'),COLORFFFFFF;
DRAWTEXT_FIX(V活跃 AND ISLASTBAR AND FROMOPEN<240 AND FROMOPEN>5,0.7,0.10,0,'预测活跃'),COLOR208FFF;
DRAWTEXT_FIX(V带量 AND ISLASTBAR AND FROMOPEN<240 AND FROMOPEN>5,0.7,0.10,0,'预测带量'),COLORYELLOW;
DRAWTEXT_FIX(V放量 AND ISLASTBAR AND FROMOPEN<240 AND FROMOPEN>5,0.7,0.10,0,'预测放量'),COLORFF00FF;
DRAWTEXT_FIX(V巨量 AND ISLASTBAR AND FROMOPEN<240 AND FROMOPEN>5,0.7,0.10,0,'预测巨量'),COLORRED;
DRAWTEXT_FIX(V怪异 AND ISLASTBAR AND FROMOPEN<240 AND FROMOPEN>5,0.7,0.10,0,'预测怪量'),COLORMAGENTA;
个股6日:=(C-MA(C,6))/MA(C,6);
个股12日:=(C-MA(C,12))/MA(C,12);
个股24日:=(C-MA(C,24))/MA(C,24);
大盘6日:=(INDEXC-MA(INDEXC,6))/MA(INDEXC,6);
大盘12日:=(INDEXC-MA(INDEXC,12))/MA(INDEXC,12);
大盘24日:=(INDEXC-MA(INDEXC,24))/MA(INDEXC,24);
大盘:=(大盘6日 + 大盘12日 + 大盘24日)/3;
个股:=(个股6日 + 个股12日 + 个股24日)/3;
DRAWTEXT_FIX(个股>大盘 AND ISLASTBAR,0.14,0.10,0,'强于大盘'),COLORYELLOW;
DRAWTEXT_FIX(个股<大盘 AND ISLASTBAR,0.14,0.10,0,'弱于大盘'),COLORGREEN;
DRAWTEXT_FIX(个股>0 AND ISLASTBAR,0.21,0.10,0,'走势较强'),COLORYELLOW;
DRAWTEXT_FIX(个股<0 AND ISLASTBAR,0.21,0.10,0,'走势较弱'),COLORGREEN;
DRAWTEXT_FIX(1,0.00,0.10,0,'友谊看盘:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.00,0.00,0,'所属代码名称:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.09,0.00,0,CODE),COLORCYAN;
DRAWTEXT_FIX(1,0.15,0,0,'所属行业:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.215,0,0,HYBLOCK),COLORCYAN;
DRAWTEXT_FIX(1,0.26,0,0,'所属地区:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.33,0,0,DYBLOCK),COLORCYAN;
DRAWTEXT_FIX(1,0.40,0,0,'所属概念:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.48,0,0,GNBLOCK),COLORCYAN;
{显示年月日星期几}
D1:=YEAR AND MONTH AND DAY;
AAA1:=STRCAT(CON2STR(YEAR,0),'年');
AAA2:=STRCAT(CON2STR(MONTH,0),'月');
AAA3:=STRCAT(CON2STR(DAY,0),'日');
AAA4:=STRCAT('【',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))));
AAA:=STRCAT(STRCAT(STRCAT(AAA1,AAA2),STRCAT(AAA3,AAA4)),'】');
DRAWTEXT_FIX(D1,0.65,0.0,0,AAA),COLORCYAN;
今总成交(亿):=AMOUNT/100000000,COLORFF00FF,NODRAW;
成交:=AMOUNT/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
今总流入(亿):=IF(CLOSE>OPEN,成交*(HIGH-LOW),IF(CLOSE<OPEN,成交*((HIGH-OPEN)+(CLOSE-LOW)),AMOUNT/2))/100000000,COLORRED,NODRAW;
今总流出(亿):=IF(CLOSE>OPEN,0-成交*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-成交*(HIGH-LOW),0-AMOUNT/2))/100000000,COLOR00FF00,NODRAW;
今净流入(亿):=今总流入(亿)+今总流出(亿),COLORYELLOW,NODRAW;
今总成交:=STRCAT(STRCAT(' 今总成交: ',CON2STR(今总成交(亿),2)),'亿');
今总流入:=STRCAT(STRCAT(' 今总流入: ',CON2STR(今总流入(亿),2)),'亿');
今总流出:=STRCAT(STRCAT(' 今总流出: ',CON2STR(今总流出(亿),2)),'亿');
今净流入:=STRCAT(STRCAT(' 今净流入: ',CON2STR(今净流入(亿),2)),'亿');
今资金流:=STRCAT('今资金流: ',STRCAT(STRCAT(STRCAT(STRCAT(今总成交,今总流入),今总流出), 今净流入),0));
DRAWTEXT_FIX(ISLASTBAR,0.00,0.05,0,今资金流),COLORYELLOW;