input:n1(5,0,30),n2(5,0,30);
ma13:ma(c,13),COLORRED,linethick2;
ma34:ma(c,34),COLORGREEN,linethick2;
ma55:ma(c,55),COLORCYAN,linethick2;
DRAWICON(cross(ma13,ma55) and ma34>ref(ma34,1) and ma55>ref(ma55,1),ma55,1);
XG:HHV(H,480),LINEDOT,COLORGREEN;
DRAWTEXT(FILTER(CROSS(C,REF(XG,1)),10) AND C>REF(XG,1),C*0.99,'突破'),COLORYELLOW;
if datatype>=0 then exit;
////////****** 计算指标变换所需的公共数据 *******
rc:=DYNAINFO(3);//前收
q:=datacount;
hh:=DYNAINFO(5);//最高
LL:=DYNAINFO(6);//最低
f:=max(hh-rc,rc-LL);
ff:=f/rc*100;//最大半振幅
////////////////////////////////////////////////////////////////
////////****** ㈠副图1叠加大盘分时线******(共3个步骤完成指标变换)
//副图1变换所需数据
q1h:=if(ff<1,0.9898*rc,rc-f*1.02);//分时副图1最高位置
q1l:=if(ff<1,0.9798*rc,rc-2*f*1.016);//分时副图1最低位置,同时也是分时副图2最高位置
//①以下计算大盘分时线的最大、最小值
R:=INDEXC;
Rh:=hhv(r,0);//最大值
RL:=LLv(r,0);//最小值
//②计算缩放比例、平移值
Rb:=(q1h-q1l)/(RH[q]-RL[q]);//缩放比例
Ry:=(q1h+q1l-rb*(RH[q]+RL[q]))/2;//平移值
//③变换原来的大盘分时到分时副图1
msd:r*rb+ry,COLORMAGENTA,LINETHICK2;//在分时副图1,显示变换后的大盘分时
/////////////////////////////////////////////////////////////////
r:=DYNAINFO(3);q:=datacount;
hh:=DYNAINFO(5);
LL:=DYNAINFO(6);
f:=max(hh-r,r-LL);
q1:=r-f*1.01;//主图下边线
q2:=r-2*f*1.0125;//副图1下边线(0位线)
q3:=r-3*f*1.014;//副图2下边线(0位线)
{有了Q1、Q2、Q3,叠加副图指标也就容易了}
//在副图1叠加RSI
r:="rsi.rsi1";
rh:=hhv(r,0);
rL:=LLv(r,0);
rb:=(q1-q2)/(rh-rL);
ry:=(q1+q2-rb*(rh+rL))/2;
rsi14:r*rb[q]+ry[q],COLORGREEN,LINETHICK2;
AAa:=REF(rsi14,N2)=HHV(rsi14,2*N2+1);
BBb:=BACKSET(AAa,N2+1);
CCc:=FILTER(BBb,N2) AND rsi14=HHV(rsi14,N2+1);
Aa1:=BARSLAST(REF(CCc,1));
顶背离:=REF(H,aA1+1)<H AND REF(rsi14,aA1+1)>rsi14 AND CCc;
DRAWLINE(CCc,rsi14,FILTER(顶背离>0,5),rsi14,0);
DRAWTEXT(顶背离,rsi14*1,'顶背离'),COLORYELLOW;
AAa2:=REF(rsi14,N2)=LLV(rsi14,2*N2+1);
BBb2:=BACKSET(AAa2,N2+1);
CCc2:=FILTER(BBb2,N2) AND rsi14=LLV(rsi14,N2+1);
Aa2:=BARSLAST(REF(CCc2,1));
底背离:=REF(L,Aa2+1)>L AND REF(rsi14,Aa2+1)<rsi14 AND CCc2;
DRAWLINE(CCc2,rsi14,FILTER(底背离>0,5),rsi14,0),COLORMAGENTA;
DRAWTEXT(底背离,rsi14,'底背离'),COLORYELLOW;
DRAWICON(cross(rsi14,msd),msd,1);
/////////////////////////////////////////////////////////////////
////////******** ㈡在副图2叠加macd ********
//副图2变换所需数据
q2h:=if(ff<1,0.9797*rc,rc-2*f*1.016);//分时副图2最高位置
q2l:=if(ff<1,0.9697*rc,rc-3*f*1.011);//分时副图2最低位置
//以下清除原始的指标线,并画横坐标线
FILLRGN(1,q2h,q2l),colorblack;
cz:=(q2h-q2l)/6;
q2l,POINTDOT,,COLORWHITE;
q2l+cz,POINTDOT,color0000cc;
q2l+2*cz,POINTDOT,color0000cc;
q2l+3*cz,POINTDOT,color0000cc;
q2l+4*cz,POINTDOT,color0000cc;
q2l+5*cz,POINTDOT,color0000cc;
a1:="macd.diff";
a2:="macd.dea";
a3:="macd.macd";
mh:=hhv(max(a1,a3),0);
mL:=LLv(min(a3,a1),0);
mb:=(q2h-q2l)/(mH[q]-mL[q]);//缩放比例,选macd或diff来计算缩放比例
my:=(q2h+q2l-mb*(mH[q]+mL[q]))/2;//平移值
diff:a1*mb+my,COLORWHITE;//副图2显示原来的diff指标线
dea:a2*mb+my,COLORYELLOW;//副图2显示原来的dea指标线
macd:=a3*mb+my;//副图2显示原来的macd指标线
STICKLINE(macd>my,my,macd,1,1),COLORRED;
STICKLINE(macd<my,my,macd,1,1),COLORCYAN;
SZ:=(3*CLOSE+2*OPEN+LOW+HIGH)/7;
趋势:=EMA(3*SZ-2*SMA(SZ,2,1),10),Colorred,linethick2;
aA1:=趋势;
aA2:=趋势;
aA3:=趋势;
mhA:=hhv(max(aA1,aA3),0);
mLA:=LLv(min(aA3,aA1),0);
mbA:=(q2h-q2l)/(mHA[q]-mLA[q]);//缩放比例,选macd或diff来计算缩放比例
myA:=(q2h+q2l-mbA*(mHA[q]+mLA[q]))/2;//平移值
hhh:aA1*mbA+myA,COLORMAGENTA;//副图2显示原来的diff指标线
AA:=REF(diff,N1)=HHV(diff,2*N1+1);
BB:=BACKSET(AA,N1+1);
CC:=FILTER(BB,N1) AND diff=HHV(diff,N1+1);
A1:=BARSLAST(REF(CC,1));
顶背离:=REF(CLOSE,A1+1)<CLOSE AND REF(diff,A1+1)>diff AND CC;
DRAWICON(顶背离,diff,2);
DRAWTEXT(顶背离,diff*1.2,'顶背离'),COLORGREEN;
DRAWLINE(CC,diff,FILTER(顶背离>0,5),diff,0),COLORRED;
AA2:=REF(diff,N1)=LLV(diff,2*N1+1);
BB2:=BACKSET(AA2,N1+1);
CC2:=FILTER(BB2,N1) AND diff=LLV(diff,N1+1);
A2:=BARSLAST(REF(CC2,1));
底背离:=REF(CLOSE,A2+1)>CLOSE AND REF(diff,A2+1)<diff AND CC2;
DRAWICON(底背离,diff,1);
DRAWTEXT(底背离,diff*1.1,'底背离'),COLORYELLOW;
DRAWLINE(CC2,diff,FILTER(底背离>0,5),diff,0),COLORRED;
{以下为千钧老师的支撑压力}
b:=BARSCOUNT(C);
d:=BARSLAST(b);
hh:=hhv(h,d);
DRAWTEXT(BARSTATUS=1,hh,STKLABEL+' '+STKNAME+' '),ColorFFFF80,pxdn20,align4,align2;
换手率:=100*v/capital,colorfffFff;
RH:=H-L;
R:=DYNAINFO(13)*100;
gj:=if(c=INDEXC,(INDEXC+INDEXh+INDEXl+INDEXO)/4,AMOUNT/ (v+0.01)/100);
明日阻力:=l+(gj-l)+(c-l);
明日支撑:=l+(c-gj);
今日阻力:=REF(明日阻力 , 1);
今日支撑:=REF(明日支撑 , 1);
DRAWTEXT(BARSTATUS=2 ,hh,'-------------------------------- -- '),ColorFFFFFF,pxdn2,align4,align2,;
DRAWTEXT(BARSTATUS=2 and c>=今日支撑,hh,' 今日支撑 =:'+NUMTOSTR(今日支撑 ,2 )+' '),ColorFF00FF,pxdn50,align4,align2,;
DRAWTEXT(BARSTATUS=2 and c<今日支撑,hh,' 今日支撑 =:'+NUMTOSTR(今日支撑 ,2 )+' '),,Color0000FF,pxdn50,align4,align2,;
DRAWTEXT(BARSTATUS=2 and c>=今日阻力,hh,' 今日阻力 =:'+NUMTOSTR(今日阻力 ,2 )+' '),align4,Color0000FF,pxdn20,align2,;
DRAWTEXT(BARSTATUS=2 and c<今日阻力,hh,' 今日阻力 =:'+NUMTOSTR(今日阻力 ,2 )+' '),Color00FF00,pxdn20,align4,align2,;
DRAWTEXT(BARSTATUS=2 ,hh,' 明日阻力=:'+NUMTOSTR(明日阻力 ,2 )+' '),Color00FFFF,pxdn20,align4,align2,;
DRAWTEXT(BARSTATUS=2 ,hh,' 明日支撑=:'+NUMTOSTR(明日支撑 ,2 )+' '),Color00FFFF,pxdn50,align4,align2,;
DRAWTEXT(BARSTATUS=2 ,hh,'-------------------------------- -- '),ColorFFFFFF,pxdn70,align4,align2,;
DRAWTEXT(BARSTATUS=2 and v>ref(v,1) and ma(v,5)>ref(ma (v,5),1),hh,'今日成交量大于昨日,且有继续增大趋势'+' '),Color8285FF,pxdn90,align4,align2,;
DRAWTEXT(BARSTATUS=2 and v<ref(v,1) and |