量化交易系统——自用的上升段量化交易系统 套装指标 源码 附图

{量化交易参考源码如下}
T:=SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),14);
HD:=HIGH-REF(HIGH,1);
LD:=REF(LOW,1)-LOW;
MP:=SUM(IF(HD>0&&HD>LD,HD,0),14);
MM:=SUM(IF(LD>0&&LD>HD,LD,0),14);
PD:=MP*100/T;
MD:=MM*100/T;
A:=PD-MD>=0;
B:=PD-MD<0;

D:=(PD-MD);
DD:=D>=0;
STICKLINE(DD,0,D,3,0),COLOR000055;
STICKLINE(DD,0,D,2.8,0),COLOR000066;
STICKLINE(DD,0,D,2.5,0),COLOR000077;
STICKLINE(DD,0,D,2.2,0),COLOR000088;
STICKLINE(DD,0,D,1.7,0),COLOR000099;
STICKLINE(DD,0,D,1.2,0),COLOR0000AA;
STICKLINE(DD,0,D,0.7,0),COLOR0000CC;
STICKLINE(DD,0,D,0.2,0),COLOR0000FF;

F:=(PD-MD);
FF:=F<0;
STICKLINE(FF,0,F,3,0),COLOR009900;
STICKLINE(FF,0,F,2,0),COLOR00BB00;
STICKLINE(FF,0,F,1,0),COLOR00DD00;
STICKLINE(FF,0,F,0.3,0),COLOR00FF00;

连续走强:BARSLASTCOUNT(D>=REF(D,1)),COLORYELLOW,NODRAW;
STICKLINE(连续走强>=2,0,D,0,0),COLORYELLOW;
强中阴:EVERY(D>0,3) AND 连续走强>=1 AND CLOSE<REF(CLOSE,1),COLORCYAN,NODRAW;
STICKLINE(EVERY(D>0,3) AND 连续走强>=1 AND CLOSE<REF(CLOSE,1),D*0.5,D*0.55,2.0,0),COLORCYAN;

{量化交易副图源码如下}

SWL:=(EMA(CLOSE,10)*7+EMA(CLOSE,20)*3)/10;
SWS:=DMA(EMA(CLOSE,20),MAX(1,100*(SUM(VOL,5)/(3*CAPITAL))));

YTSL:=(3*CLOSE+LOW+OPEN+HIGH)/6;
VAR1:=(CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2));
VAR2:=(REF(VAR1,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR3:=(REF(VAR2,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR4:=(REF(VAR3,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR5:=(REF(VAR4,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR6:=(REF(VAR5,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR7:=(REF(VAR6,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR8:=(REF(VAR7,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR9:=(REF(VAR8,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VARA:=(REF(VAR9,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VARB:=(REF(VARA,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VARC:=(REF(VARB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VARD:=(CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2));
VARYY:=(CLOSE/REF(CLOSE,1))>1.05 AND C>O AND C>REF(C,1);
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);
VAR1A:=((REF(VAR1 OR VAR2 OR VAR3 OR VAR4 OR VAR5 OR VAR6 OR VAR7 OR VAR8 OR VAR9 OR VARA OR VARB OR VARC,1)) AND VARD);
买:VAR19 AND (SWL>SWS OR CROSS(CLOSE,MAX(SWL,SWS))),COLORRED,LINETHICK2;
DRAWTEXT(买,0.88,'←买'),COLORRED;
加:VAR19 AND VARYY AND (SWL>SWS OR CROSS(CLOSE,MAX(SWL,SWS))),COLORWHITE,STICK,LINETHICK2;
DRAWTEXT(加,0.68,'←加'),COLORWHITE;


{量化交易主图源码如下}

{虚拟成交量}
TOTAL:=IF(PERIOD=1,5,IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,TOTALFZNUM,1)))));
MTIME:=MOD(FROMOPEN,TOTAL);
CTIME:=IF(MTIME<0.5,TOTAL,MTIME);
VVOL:=IF((CURRBARSCOUNT=1 AND DYNAINFO(8)>1),VOL*(TOTAL+3)/(CTIME+3),VOL);
今夕比:=VVOL/REF(VOL,1);

ISST股:=(NAMELIKE('S') OR NAMELIKE('*')) AND NOT(CODELIKE('68') OR CODELIKE('30'));
ZTBL:=IF(FINANCE(3)=2,0.3,IF((FINANCE(3)=4 OR FINANCE(3)=3 OR CODELIKE('11') OR CODELIKE('12')),0.2,0.1));
涨停价:ZTPRICE(REF(CLOSE,1),IF(ISST股,0.05,ZTBL)),COLORRED,NODRAW;
跌停价:DTPRICE(REF(CLOSE,1),IF(ISST股,0.05,ZTBL)),COLORFF8000,NODRAW;
涨停:=CLOSE>=ZTPRICE(REF(CLOSE,1),IF(ISST股,0.05,ZTBL));
STICKLINE(涨停,OPEN,CLOSE,3,0),COLORRED;
STICKLINE(涨停,HIGH,LOW,0,0),COLORRED;
跌停:=CLOSE<=DTPRICE(REF(CLOSE,1),IF(ISST股,0.05,ZTBL));
STICKLINE(跌停,OPEN,CLOSE,3,0),COLORFF8000;
STICKLINE(跌停,HIGH,LOW,0,0),COLORFF8000;
日涨幅:=(CLOSE-REF(CLOSE,1))/REF(CLOSE,1)*100;

{定义}
一板:=涨停 AND REF(NOT(涨停),1);
DRAWNUMBER(一板,LOW,1),COLORB302DF;
二板:=涨停 AND REF(涨停,1) AND REF(NOT(涨停),2);
DRAWNUMBER(二板,LOW,2),COLORCB02FD;
三板:=涨停 AND REF(COUNT(涨停,2)=2,1) AND REF(NOT(涨停),3);
DRAWNUMBER(三板,LOW,3),COLORD32DFD;
四板:=涨停 AND REF(COUNT(涨停,3)=3,1) AND REF(NOT(涨停),4);
DRAWNUMBER(四板,LOW,4),COLORDD58FE;
五板:=涨停 AND REF(COUNT(涨停,4)=4,1) AND REF(NOT(涨停),5);
DRAWNUMBER(五板,LOW,5),COLORE378FE;
六板:=涨停 AND REF(COUNT(涨停,5)=5,1) AND REF(NOT(涨停),6);
DRAWNUMBER(六板,LOW,6),COLORE994FE;
七板:=涨停 AND REF(COUNT(涨停,6)=6,1) AND REF(NOT(涨停),7);
DRAWNUMBER(七板,LOW,7),COLOREDA9FE;
八板:=涨停 AND REF(COUNT(涨停,7)=7,1) AND REF(NOT(涨停),8);
DRAWNUMBER(八板,LOW,8),COLORF2C1FF;
九板:=涨停 AND REF(COUNT(涨停,8)=8,1) AND REF(NOT(涨停),9);
DRAWNUMBER(九板,LOW,9),COLORF7D7FF;
十板:=涨停 AND REF(COUNT(涨停,9)=9,1) AND REF(NOT(涨停),10);
DRAWNUMBER(十板,LOW,10),COLORWHITE;

SWL:(EMA(CLOSE,10)*7+EMA(CLOSE,20)*3)/10,COLORWHITE;
SWS:DMA(EMA(CLOSE,20),MAX(1,100*(SUM(VOL,5)/(3*CAPITAL)))),COLORYELLOW;
STICKLINE(SWL>=SWS AND (SWL-SWS)>=REF(SWL-SWS,1),SWS,SWL,0,-1),COLORMAGENTA;
STICKLINE(SWL>=SWS AND (SWL-SWS)<REF(SWL-SWS,1),SWS,SWL,0,-1),COLORYELLOW;
STICKLINE(SWL<SWS AND (SWL-SWS)>REF(SWL-SWS,1),SWS,SWL,0,-1),COLORLICYAN;
STICKLINE(SWL<SWS AND (SWL-SWS)<REF(SWL-SWS,1),SWS,SWL,0,-1),COLORGREEN;

YTSL:=(3*CLOSE+LOW+OPEN+HIGH)/6;
VAR1:=(CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2));
VAR2:=(REF(VAR1,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR3:=(REF(VAR2,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR4:=(REF(VAR3,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR5:=(REF(VAR4,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR6:=(REF(VAR5,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR7:=(REF(VAR6,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR8:=(REF(VAR7,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR9:=(REF(VAR8,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VARA:=(REF(VAR9,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VARB:=(REF(VARA,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VARC:=(REF(VARB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VARD:=(CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2));
VARYY:=(CLOSE/REF(CLOSE,1))>1.05 AND C>O AND C>REF(C,1);
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);
VAR1A:=((REF(VAR1 OR VAR2 OR VAR3 OR VAR4 OR VAR5 OR VAR6 OR VAR7 OR VAR8 OR VAR9 OR VARA OR VARB OR VARC,1)) AND VARD);
买:VAR19 AND (SWL>SWS OR CROSS(CLOSE,MAX(SWL,SWS))),COLORRED,NODRAW;
加:VAR19 AND VARYY AND (SWL>SWS OR CROSS(CLOSE,MAX(SWL,SWS))),COLORWHITE,NODRAW;
DRAWICON(买,LOW,1);
DRAWICON(加,LOW,23);
DRAWICON(买,LOW,1);

JRH:=HHV(C,2);
JRL:=LLV(C,2);
MA3:=MA(CLOSE,3);
持股:VAR1 OR VAR2 OR VAR3 OR VAR4 OR VAR5 OR VAR6 OR VAR7 OR VAR8 OR VAR9 OR VARA OR VARB OR VARC,COLOR0000FF,NODRAW;
离场:=IF(持股,JRL,DRAWNULL);
明离场价:=离场;
今离场价:=REF(离场,1);
观望:VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18,COLORC0C0C0,NODRAW;
进:=IF(观望,JRH,DRAWNULL);
明进场价:=进;
今进场价:=REF(明进场价,1);
短买:VAR19,COLOR33AACC,NODRAW;
持币:VAR1A,COLORFF99FF,NODRAW;
急速超跌:(CLOSE-MA(CLOSE,34))/MA(CLOSE,34)*100<-14,COLORC0C0C0,NODRAW;
STICKLINE(急速超跌,MIN(OPEN,CLOSE),(C+O)/2,1.5,0),COLORC0C0C0;{灰色}

E:=(HIGH+LOW+OPEN+2*CLOSE)/5;
明阻力:=2*E-LOW;
明支撑:=2*E-HIGH;
明突破:=E+(HIGH-LOW);
明反转:=E-(HIGH-LOW);
今阻力:=REF(明阻力,1);
今支撑:=REF(明支撑,1);


{评分系统}
{MACD}
DIF:=100*(EMA(CLOSE,12)-EMA(CLOSE,26));
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
{KDJ}
RSV:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*100;
K:=SMA(RSV,20,1);
D:=SMA(K,5,1);
J:=3*K-2*D;

{SKDJ}
LOWV35:=LLV(LOW,35);
HIGHV35:=HHV(HIGH,35);
RSV35:=EMA((CLOSE-LOWV35)/(HIGHV35-LOWV35)*100,5);
K35:=EMA(RSV35,5);
D35:=MA(K35,5);
LOWV34:=LLV(LOW,34);
HIGHV34:=HHV(HIGH,34);
RSV34:=EMA((CLOSE-LOWV34)/(HIGHV34-LOWV34)*100,3);
K34:=EMA(RSV34,3);
D34:=MA(K34,3);
{WR}
WR32:=100*(HHV(HIGH,32)-CLOSE)/(HHV(HIGH,32)-LLV(LOW,32));

{量化评分}
LH1:=IF(MA(C,5)>MA(C,10),20,0);
LH2:=IF(MA(C,20)>MA(C,60),10,0);
LH3:=IF(J>K,10,0);
LH4:=IF(DIF>DEA,10,0);
LH5:=IF(VVOL>MA(VOL,60),10,0);
LH6:=IF(K35>D35,5,0);
LH7:=IF(K34>D34,5,0);
LH8:=IF(WR32<=REF(WR32,1),10,0);
LH9:=IF(WINNER(C)>0.5,10,0);
LH10:=IF(C/REF(C,1)>1.03,10,0);
评分:LH1+LH2+LH3+LH4+LH5+LH6+LH7+LH8+LH9+LH10,COLORLIGRAY,NODRAW;

{屏幕上部提示}
L所属板块:=STRCAT(STRCAT(STRCAT('所属板块:',HYBLOCK),STRCAT('-',DYBLOCK)),STRCAT('-',GNBLOCK));
DRAWTEXT_FIX(1,0,0,0,L所属板块),COLORMAGENTA;
F股本:=CON2STR(FINANCE(1)/100000000,2);
L1A:=STRCAT('股本:',F股本);
F收入增:=CON2STR(FINANCE(44),2);
L1B:=STRCAT(STRCAT('收入增:',F收入增),'%');
F流股:=CON2STR(CAPITAL/1000000,2);
L2A:=STRCAT('流股:',F流股);
F毛利:=CON2STR((FINANCE(20)-FINANCE(21))/FINANCE(20)*100,2);
L2B:=STRCAT(STRCAT('毛利:',F毛利),'%');
F市值:=CON2STR(TOTALCAPITAL/1000000*CLOSE,2);
L3A:=STRCAT('市值:',F市值);
F净利:=CON2STR(FINANCE(30)/FINANCE(20)*100,2);
L3B:=STRCAT(STRCAT('净利:',F净利),'%');
F流通:=CON2STR(CAPITAL/1000000*CLOSE,2);
L4A:=STRCAT('流通:',F流通);
F净增:=CON2STR(FINANCE(43),2);
L4B:=STRCAT(STRCAT('净增:',F净增),'%');
F市盈率:=CON2STR(CLOSE/FINANCE(38),2);
L5:=STRCAT('市盈率:',F市盈率);
DRAWTEXT_FIX(1,0,0.1,0,L1A),COLORCYAN;
DRAWTEXT_FIX(1,0.08,0.1,0,L1B),COLORYELLOW;
DRAWTEXT_FIX(1,0,0.14,0,L2A),COLORCYAN;
DRAWTEXT_FIX(1,0.08,0.14,0,L2B),COLORYELLOW;
DRAWTEXT_FIX(1,0,0.18,0,L3A),COLORCYAN;
DRAWTEXT_FIX(1,0.08,0.18,0,L3B),COLORYELLOW;
DRAWTEXT_FIX(1,0,0.22,0,L4A),COLORCYAN;
DRAWTEXT_FIX(1,0.08,0.22,0,L4B),COLORYELLOW;
DRAWTEXT_FIX(1,0,0.26,0,L5),COLORCYAN;

{屏幕下部提示}
涨家:=STRCAT(STRCAT('总上涨:',CON2STR(DYNAINFO(60),0)),' 只');
跌家:=STRCAT(STRCAT('总下跌:',CON2STR(DYNAINFO(61),0)),' 只');
DRAWTEXT_FIX(ISLASTBAR,0,1,0,涨家),COLORRED;
DRAWTEXT_FIX(ISLASTBAR,0.12,1,0,跌家),COLORGREEN;
涨跌比:=STRCAT(STRCAT('涨跌比:',CON2STR(DYNAINFO(60)/(DYNAINFO(60)+DYNAINFO(61))*100,2)),' %');
DRAWTEXT_FIX(ISLASTBAR,0.23,1,0,涨跌比),COLORWHITE;
DRAWTEXT_FIX(ISLASTBAR AND 评分<=50,0.88,1,0,STRCAT('今日量化评分:',STRCAT(CON2STR(评分,2),' '))),COLORWHITE;
DRAWTEXT_FIX(ISLASTBAR AND 评分>50,0.88,1,0,STRCAT('今日量化评分:',STRCAT(CON2STR(评分,2),' '))),COLORMAGENTA;


未来函数检测结果如下:
该公式包含未来函数:WINNER
该公式包含未来函数:CAPITAL
该公式包含未来函数:DYNAINFO
该公式包含未来函数:FINANCE
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  股票指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股票指标网别名指标网仅为互联网文章,所有股票指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。股票指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图