{优化整合指标}
INPUT:RQA(2011,1990,3000),RQB(1,1,12),RQC(1,1,31),DF(0,0,6),FA(0,0,3),EA(0,0,2);
INPUT:P1(5,0,255),P2(10,0,255),P3(20,0,255),P4(55,0,255),P5(120,0,255);
TTt:=ISLASTBAR=1;
AS1:=((H-L)/L)*100;
AS2:=H-L;
MAI:=C*1.015;
MAII:=C*1.03;
DRAWTEXTEX(TTT,0,310,1,'▼明短线赢利[1.5%--3%:]'+'/'+NUMTOSTR(MAI[SYSPARAM(1)],2)+'--'+NUMTOSTR(MAII [SYSPARAM(1)],2)),Color00dd00;
DRAWTEXTEX(TTt,0,176,1,'【振幅:'+NUMTOSTR(AS1[SYSPARAM(1)],2)+'% '+NUMTOSTR(AS2[SYSPARAM(1)],2)+'元 】'+''),Colordddd00;
DRAWTEXTEX(TTT,0,1,1,'【代码:'+STKLABEL+' 名称:'+STKNAME+'】'),ColorffFFFF;//DRAWTEXTEX(TTT,0,270,14,'【创于2011.02.17晚】'),ColorffFFFF;
aa:=BLKNAME;
BB:=STRLEFT(AA,STRFIND(AA,',',1)-1);
K:=STKCOUNT(BB);
SYL:=C/FINANCE(33);
DRAWTEXTEX(TTT AND fa,0,3,14,' 所属板块: '+BB+', 共有:'+NUMTOSTR(K,0)+' 家上市公司'+' 发行价'+NUMTOSTR(FINANCE(51),2)+'元'+' 发行量'+NUMTOSTR(FINANCE(52),2)+ '万股【市盈率:'+NUMTOSTR(SYL,2)),COLORDDaaDD;
RQD:=(RQA-1900)*10000+RQB*100+RQC;
DJ:=REF(L,BARSLAST(DATE<=RQD ));//求某一日期的最低价
上涨:=BARSSINCE(BACKSET(BARSTATUS=2,BARSLAST(L=DJ)+1));
VERTLINE(DJ AND DATE>=RQD AND DF>=1),COLOR444444,LINEDOT;//画垂直线
STICKLINE(C>=O,low,high,0.5,0),colorFF;
STICKLINE(C>=O,close,open,8,0),color102088;
STICKLINE(C>=O,close,open,7,0),color102099;
STICKLINE(C>=O,close,open,6,0),color1020AA;
STICKLINE(C>=O,close,open,5,0),color1020BB;
STICKLINE(C>=O,close,open,4,0),color1020CC;
STICKLINE(C>=O,close,open,3,0),color1020DD;
STICKLINE(C>=O,close,open,2,0),color1020EE;
STICKLINE(C>=O,close,open,1,0),color1020FF;
STICKLINE(C<=O,low,high,0.5,0),colorFF8800;
STICKLINE(C<=O,close,open,8,0),colorFF7700;
STICKLINE(C<=O,close,open,7,0),colorFF8800;
STICKLINE(C<=O,close,open,6,0),colorFF9900;
STICKLINE(C<=O,close,open,5,0),colorFFAA00;
STICKLINE(C<=O,close,open,4,0),colorFFBB00;
STICKLINE(C<=O,close,open,3,0),colorFFCC00;
STICKLINE(C<=O,close,open,2,0),colorFFDD00;
STICKLINE(C<=O,close,open,1,0),colorFFEE00;
POLYLINE(DATE>=RQD AND DF>=1,DJ),Color999999;//实用画直线
POLYLINE(DATE>=RQD AND DF>=2,DJ*1.03),Color999999,LINEDOT;//实用画直线
POLYLINE(DATE>=RQD AND DF>=2,DJ*1.05),Color999999,LINEDOT;//实用画直线
POLYLINE(DATE>=RQD AND DF>=3,DJ*1.08),Color999999,LINEDOT;//实用画直线
POLYLINE(DATE>=RQD AND DF>=3,DJ*1.13),Color999999,LINEDOT;//实用画直线
POLYLINE(DATE>=RQD AND DF>=4,DJ*1.18),Color999999,LINEDOT;//实用画直线
POLYLINE(DATE>=RQD AND DF>=4,DJ*1.25),Color999999,LINEDOT;//实用画直线
POLYLINE(DATE>=RQD AND DF>=5,DJ*1.34),Color999999,LINEDOT;//实用画直线
POLYLINE(DATE>=RQD AND DF>=5,DJ*1.37),Color999999,LINEDOT;//实用画直线
DRAWTEXT(上涨=0 AND DF>=1,DJ,'1'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=1 AND DF>=1,DJ,'2'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=2 AND DF>=1,DJ,'3'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=3 AND DF>=1,DJ,'4'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=4 AND DF>=1,DJ,'5'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=5 AND DF>=1,DJ,'6'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=6 AND DF>=1,DJ,'7'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=7 AND DF>=1,DJ,'8'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=8 AND DF>=1,DJ,'9'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=9 AND DF>=1,DJ,'10'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=10 AND DF>=1,DJ,'11'),COLORFFFFFF,pxdn5;
DRAWTEXT(上涨=11 AND DF>=1,DJ,'12'),COLORFFFFFF,pxdn5;
{单阳不破}
//阳涨幅:=4;
//阳倍量:=2;
//单阳:=C>O*(1+阳涨幅/100) AND VOL>REF(VOL,1)*阳倍量;
阳涨幅:=3.5;
阳倍量:=1.9;
单阳收:=C;
单阳开:=O;
单阳:=单阳收>=REF(C,1)*(1+阳涨幅/100)AND VOL>REF(VOL,1)*阳倍量;
DRAWTEXT(BARSTATUS=0 AND 单阳,L,'阳'),COLOR00FFFF,pxdn5;
高不破价:=REF(C,BARSLAST(单阳));
低不破价:=REF(L,BARSLAST(单阳));
单阳不破:=BARSTATUS=0 AND BARSLAST(单阳)<11 AND (LLV(L,BARSLAST(单阳))>低不破价 OR LLV(L,BARSLAST(单阳))=低不破价);
STICKLINE(单阳不破,低不破价-低不破价*0.0005,低不破价,11,0),COLORGREEN;
STICKLINE(单阳不破,高不破价,高不破价,11,0),COLORRED;
STICKLINE(单阳,单阳开,单阳收,6,0),COLORYELLOW;
QKB:=IF(C>O,O,C);
QKAB:=IF(C>O,O+(C-O)*0.75,O+(C-O)*0.75);
STICKLINE(BARSTATUS=0 AND 单阳,QKB,QKAB,6,0),COLORFF2693;
实体幅度2:=REF((O+(C-O)*0.667),BARSLAST(单阳));{//当日实体幅度的2/3}
实体幅度1:=REF((O+(C-O)*0.333),BARSLAST(单阳));{//当日实体幅度的1/3}
幅度的1二:=REF((L+(H-L)/2),BARSLAST(单阳));{//当日幅度的1/2}
STICKLINE(单阳不破,幅度的1二,幅度的1二,8,1),COLOR209FFF,LINEDOT;
STICKLINE(单阳不破,实体幅度2,实体幅度2,11,1),COLORFFFF00,LINEDOT;
STICKLINE(单阳不破,实体幅度1,实体幅度1,11,1),COLORFFFF00,LINEDOT;
DRAWTEXT(BARSLAST(单阳)=1 AND 单阳不破,低不破价,'1'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=2 AND 单阳不破,低不破价,'2'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=3 AND 单阳不破,低不破价,'3'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=4 AND 单阳不破,低不破价,'4'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=5 AND 单阳不破,低不破价,'5'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=6 AND 单阳不破,低不破价,'6'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=7 AND 单阳不破,低不破价,'7'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=8 AND 单阳不破,低不破价,'8'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=9 AND 单阳不破,低不破价,'9'),COLORGREEN,pxdn5;
DRAWTEXT(BARSLAST(单阳)=10 AND 单阳不破,低不破价,'10'),COLORGREEN,pxdn5;
DRAWTEXT(上涨=0 AND DF>=2,DJ*1.03,' 3% ['+NUMTOSTR(DJ*1.03,2)+']'),ALIGN1,PXDN5,COLORWHITE;
DRAWTEXT(上涨=0 AND DF>=2,DJ*1.05,' 5% ['+NUMTOSTR(DJ*1.05,2)+']'),ALIGN1,PXDN5,COLORWHITE;
DRAWTEXT(上涨=0 AND DF>=3,DJ*1.08,' 8% ['+NUMTOSTR(DJ*1.08,2)+']'),ALIGN1,PXDN5,COLORWHITE;
DRAWTEXT(上涨=0 AND DF>=3,DJ*1.13,' 13% ['+NUMTOSTR(DJ*1.13,2)+']'),ALIGN1,PXDN5,COLORWHITE;
DRAWTEXT(上涨=0 AND DF>=4,DJ*1.18,' 18% ['+NUMTOSTR(DJ*1.18,2)+']'),ALIGN1,PXDN5,COLORWHITE;
DRAWTEXT(上涨=0 AND DF>=4,DJ*1.25,' 25% ['+NUMTOSTR(DJ*1.25,2)+']'),ALIGN1,PXDN5,COLORWHITE;
DRAWTEXT(上涨=0 AND DF>=5,DJ*1.34,' 34% ['+NUMTOSTR(DJ*1.34,2)+']'),ALIGN1,PXDN5,COLORWHITE;
DRAWTEXT(上涨=0 AND DF>=5,DJ*1.37,' 37% ['+NUMTOSTR(DJ*1.37,2)+']'),ALIGN1,PXDN5,COLORWHITE;
{一阳穿三线}
MA2:=EMA(C,2);
MA5:=EMA(C,5),COLORFFFFFF;
MA13:=EMA(C,13),COLOR00FFFF;
MA34:=EMA(C,34),COLORFF00FF;
MA55:=EMA(C,55),COLOR00FF00;
YCX:=MA5>=REF(MA5,1);
H1:=MAX(MAX(MA5,MA13),MA34);
L1:=MIN(MIN(MA5,MA13),MA34);
QK:=IF(C>O,O,C);
QKA:=IF(C>O,O+(C-O)*0.35,O+(C-O)*0.25);
一阳穿三线:= H1<C AND O<L1 AND YCX AND MA2>REF(MA2,1);
STICKLINE(一阳穿三线,QK,QKA,6,0),COLORYELLOW;
BQ:=IF((SYSPARAM(1) = (BARSSINCE((C > 0)) + 1)),1,0);
DRAWTEXT((BQ > 0) AND 一阳穿三线,L,''+':一阳穿三线'),pxup39,COLORFFFF00,ALIGN1;
BQ1:=(H<REF(L,1));BQ2:=(L>REF(H,1));
BQ3:=REF(L,1)-H; BQ4:=L-REF(H,1);
BQ5:=REF(L,1); BQ6:=H;
BQ7:=REF(H,1); BQ8:=L;
QZH:=IF(BQ1,BQ1,BQ2);
QZH1:=IF(BQ1,BQ5,BQ7);
QZH2:=IF(BQ1,BQ6,BQ8);
QK:=IF(C>O,C,O);
QK1:=IF(C>O,O,C);
QKA:=IF(C>O,o+(c-o)*0.65,o+(c-o)*0.35);
QKB:=IF(C>O,o+(c-o)*0.35,o+(c-o)*0.65);
STICKLINE(BQ1,QKA,QK,5.5,0),colorEE0000;
STICKLINE(BQ2,QKB,QK1,5,0),color20CEEE;
DRAWTEXT(((BQ > 0) AND Bq1),H,'↓缺口 '+'\n '+NUMTOSTR(BQ3[SYSPARAM(1)],2)+' '+'\n '+NUMTOSTR(BQ5[SYSPARAM(1)],2)+'-'+NUMTOSTR(BQ6[SYSPARAM(1)],2)+' '),colorFFFFEE,pxdn10,ALIGN2;
DRAWTEXT(((BQ > 0) AND Bq2),L,'↑缺口 '+'\n '+NUMTOSTR(BQ4[SYSPARAM(1)],2)+' '+'\n '+NUMTOSTR(BQ7[SYSPARAM(1)],2)+'-'+NUMTOSTR(BQ8[SYSPARAM(1)],2)+' '),color00FFEE,pxup20,ALIGN2;
DRAWSL(SYSPARAM(1)=BARPOS AND QZH,QZH1,0,0,0),COLOR888888;//随光标显示缺口直线
DRAWSL(SYSPARAM(1)=BARPOS AND QZH,QZH2,0,0,0),COLOR888888;
QKD:=BQ8[DATACOUNT]; QKE:=0;
QK:=IF(BQ2,1,IF(BQ1,-1,0));
for I=DATACOUNT-1 downto 2 do begin
IF BQ8[I ]<QKD then QKD:=BQ8 [I ];
IF BQ6[I ]>QKE then QKE:=BQ6 [I ];
IF QK[I ]=1 and QKD<=BQ6[I-1] then QK [I ]:=0;
IF QK[I ]=-1 and QKE>=BQ8[I-1] then QK [I ]:=0;
end;
DRAWTEXT(QK=1,BQ8,'未补'),COLOR999999,PXUP;
DRAWTEXT(QK=-1,BQ6,'未补 '),COLOR999999,PXDN ;
AS:=(o+h+l+c)/4;
BL:=EMA(AS,17);
BLS:=BL+2.58*STDP(C,20);
BL2:=BL+1.96*STDP(C,20);
BL3:=BL-1.96*STDP(C,20);
BLX:=BL-2.58*STDP(C,20);
mm:=SYSPARAM(5);
BMA:IF(EA=1,BLS,mm),LINETHICK1,COLOR00FFFF,LINEDOT;
BMB:IF(EA=1,BL2,mm),LINETHICK1,COLORFF99FF,LINEDOT;
BMC:IF(EA=1,BL3,mm),LINETHICK1,COLORF0FF00,LINEDOT;
BMD:IF(EA=1,BLX,mm),LINETHICK1,COLOR00FF00,LINEDOT;
BME:IF(EA=1,BL,mm),LINETHICK1,COLOR00FFFF;
BLT:=BARSTATUS=2 AND EA=1;
DRAWTEXT(BLT AND BLS>REF(BLS,1),BLS,'↑:'+NUMTOSTR(BLS,2)),COLOR00ffff;
DRAWTEXT(BLT AND BLS<REF(BLS,1),BLS,'↓:'+NUMTOSTR(BLS,2)),Color4BFACE;
DRAWTEXT(BLT AND BL2>REF(BL2,1),BL2,'↑:'+NUMTOSTR(BL2,2)),COLORMAGENTA;
DRAWTEXT(BLT AND BL2<REF(BL2,1),BL2,'↓:'+NUMTOSTR(BL2,2)),ColorF29BE1;
DRAWTEXT(BLT AND BL>REF(BL,1),BL,' ↑:'+NUMTOSTR(BL,2)),COLOR00ffff;
DRAWTEXT(BLT AND BL<REF(BL,1),BL,' ↓:'+NUMTOSTR(BL,2)),Color00FF00;
DRAWTEXT(BLT AND BL3>REF(BL3,1),BL3,'↑:'+NUMTOSTR(BL3,2)),COLORffff00;
DRAWTEXT(BLT AND BL3<REF(BL3,1),BL3,'↓:'+NUMTOSTR(BL3,2)),ColorFAD994;
DRAWTEXT(BLT AND BLX>REF(BLX,1),BLX,'↑:'+NUMTOSTR(BLX,2)),COLOR00ff00;
DRAWTEXT(BLT AND BLX<REF(BLX,1),BLX,'↓:'+NUMTOSTR(BLX,2)),ColorB7FD91;
{1.96统计学中为95%可信区间,2.58为99%可信区间,故采用1.96和2.58作为参数}
DI:=EMA(CLOSE,10) - EMA(CLOSE,22);
PARTLINE(EA=1 AND BL<REF(BL,1),BL),colorffF000,linethick1;
DRAWICON(CROSS(H,BLS),H,5);
DRAWICON(CROSS(H,BL2),H,7),pxup19;
DRAWICON(CROSS(C,BL) AND BL>REF(BL,1) AND DI>REF(DI,1),L,8);
LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
PARTLINE(RSI1>76,H),CIRCLEDOT,LINETHICK1,COLORFFFF00,pxup5;
PARTLINE(RSI1>80,H),CROSSDOT,LINETHICK1,COLOR000FF,pxup5;
DRAWTEXT((BQ > 0) AND RSI1>76,h,''+NUMTOSTR(RSI1[SYSPARAM(1)],2)+':RSI>76 '),pxup29,COLORFFFF00,ALIGN2;
DRAWTEXT((BQ > 0) AND CROSS(H,BL2),h,''+NUMTOSTR(BL2[SYSPARAM(1)],2)+':上穿上轨'),pxup39,COLORFFFF00,ALIGN1;
DRAWTEXT((BQ > 0) AND CROSS(H,BLS),h,''+NUMTOSTR(BLS[SYSPARAM(1)],2)+':上穿外轨'),pxup39,COLORFFFF00,ALIGN2;
MMA5:=EMA(AS,P1);
SYAA:=EMA(AS,P2);
SYAB:=EMA(AS,P3);
SYAC:=EMA(AS,P4);
SYAD:=EMA(AS,P5);
BMA5:IF(EA=2,MMA5,mm),LINETHICK1,COLORFFFFFF;
BMA10:IF(EA=2,SYAA,mm),LINETHICK1,COLOR00FFFF;
BMA20:IF(EA=2,SYAB,mm),LINETHICK1,COLORFF99FF;
BMA55:IF(EA=2,SYAC,mm),LINETHICK1,COLOR209FFF;
BMAX:IF(EA=2,SYAD,mm),LINETHICK1,COLORFFFF00;
BLTF:=BARSTATUS=2 AND EA=2;
DRAWTEXT(BLTF AND MMA5>REF(MMA5,1),MMA5,'↑:'+NUMTOSTR(MMA5,2)),COLORFFffff;
DRAWTEXT(BLTF AND MMA5<REF(MMA5,1),MMA5,'↓:'+NUMTOSTR(MMA5,2)),ColorFFFFFF;
DRAWTEXT(BLTF AND SYAA>REF(SYAA,1),SYAA,'↑:'+NUMTOSTR(SYAA,2)),COLOR00ffff;
DRAWTEXT(BLTF AND SYAA<REF(SYAA,1),SYAA,'↓:'+NUMTOSTR(SYAA,2)),Color00FFFF;
DRAWTEXT(BLTF AND SYAB>REF(SYAB,1),SYAB,'↑:'+NUMTOSTR(SYAB,2)),COLORFF99ff;
DRAWTEXT(BLTF AND SYAB<REF(SYAB,1),SYAB,'↓:'+NUMTOSTR(SYAB,2)),ColorFF99FF;
DRAWTEXT(BLTF AND SYAC>REF(SYAC,1),SYAC,'↑:'+NUMTOSTR(SYAC,2)),COLOR209fff;
DRAWTEXT(BLTF AND SYAC<REF(SYAC,1),SYAC,'↓:'+NUMTOSTR(SYAC,2)),Color209FFF;
DRAWTEXT(ttt,MM,'价 ['+NUMTOSTR(MM,2)+']'),ALIGN2,PXUP25,COLOR999999;
STICKLINE(C=C AND fa>=1,O+((C-O)*0.667),(O+(C-O)*0.667),4,0),COLORFF0000,LINETHICK1;{//当日实体幅度的2/3}
STICKLINE(C=C AND fa>=1,O+((C-O)*0.333),(O+(C-O)*0.333),4,0),COLORFF0000,LINETHICK1;{//当日实体幅度的1/3}
STICKLINE(C=C AND fa>=1,O+((C-O)/2),(O+(C-O)/2),5,0),COLOR00FFFF,LINETHICK1;{//当日实体幅度的1/2}
STICKLINE(C=C AND fa>=1,L+((H-L)/2),(L+(H-L)/2),6,0),COLOR208FFF,LINETHICK1;{//当日幅度的1/2}
STICKLINE(C=C AND fa>=1,IF(C>O,H-((H-C)/2),H-((H-O)/2)),IF(C>O,H-((H-C)/2),H-((H-O)/2)),1.3,0),COLORYELLOW,LINETHICK1;{//当日上影线幅度的1/2}
STICKLINE(C=C AND fa>=1,IF(C<O,L+((C-L)/2),L+((O-L)/2)),IF(C<O,L+((C-L)/2),L+((O-L)/2)),1.3,0),COLORYELLOW,LINETHICK1;{//当日下影线幅度的1/2};
AJ:=AMOUNT/(VOL*100),COLORFFFFFF,LINETHICK0;
DRAWTEXT(C=C AND fa=2,AJ,'←'),COLORFF5f00;
A3:=C=HHV(C,6);
A9:=C=LLV(C,6);
A4:=BARSLAST(A3);
A5:=BARSLAST(A9);
A6:=IF(A4,REF(C,A4),REF(C,A4))*1.005;
A7:=IF(A5,REF(C,A5),REF(C,A5))*0.995;
PARTLINE(A6=ref(A6,1) AND FA>=2,A6),COLOR00ff00,LINEDOT;
PARTLINE(A7=ref(A7,1) AND FA>=2,A7),COLOR00ffff,LINEDOT;
涨停:=C>REF(C,1)*1.099;
盘价:=REF(O,BARSLAST(涨停)),COLOR666666{,DOTLINE,POINTDOT},LINEDASHDOT;
盘价A:=REF(C,BARSLAST(涨停)),COLOR666666{,DOTLINE,POINTDOT},LINEDASHDOT;
POLYLINE(盘价 AND FA>=3,盘价),LINEDASHDOT,Color555555;//实用画直线
POLYLINE(盘价A AND FA>=3,盘价A),LINEDASHDOT,Color555555;//实用画直线
DRAWTEXT(ttt AND FA>=3,盘价A,'↓涨停K线价 ['+NUMTOSTR(盘价A,2)+']'),ALIGN2,PXUP25,COLOR999999;
DRAWTEXT(ttt AND FA>=3,盘价,'↑开盘K线价 ['+NUMTOSTR(盘价,2)+']'),ALIGN2,PXDN5,COLOR999999;
{添加参数精灵
{--------显示年月日低点日期--------}
调整年 Param#1 显示年度
调整月 Param#2 显示月份
调整日 Param#3 显示日期
---------参数=1显示低点水平线------
参数=2--5 Param#4 显示涨幅幅度线
参数=0--2 Param#5 显示K线幅度线
参数=1--2 Param#6 转换布林与EMA线
--------显示均价线--------
P1计算 Param#7 任意均价线;
P2计算 Param#8 任意均价线;
P3计算 Param#9 任意均价线;
P4计算 Param#10 任意均价线;
P5计算 Param#11 任意均价线;