N1:=5;
均价:=(0.618*(0.809*C+0.191*o)+0.382*(if(H=C,C,H)+if(L=C,C,L))/2);
lj:=if(STKTYPE=0,均价,AMOUNT/(V*100));
R:=(0.809*if(L=C,C,L)+0.191*lj);R1:=(0.809*if(H=C,C,H)+0.191*lj);kx:=(r+R1)/2;
kX:=(R+R1)/2;
HL:=SQRT(r1-r)+(r1=r);
JFC:=IF(CAPITAL>0,HL,SQRT(kx));
SF:=JFC;zl:=1/JFC;
MA3:=MA(R*zl,3)/MA(zl,3),COLORWHITE,PRECISION2;
工作线:=EMA(SUM(KX*V,3)/SUM(V,3),13),COLORYELLOW,LINETHICK1,PRECISION2;
角:=ATAN((工作线/ref(工作线,1)-1)*100)*180/3.1416,LINETHICK,COLORGREEN;
M3:=EMA((R+r1)/2,3);
M5:=EMA((R+r1)/2,5);
M8:=EMA((R+r1)/2,8),COLORWHITE;
M13:=EMA((R+r1)/2,13);
M21:=EMA((R+r1)/2,21),COLORYELLOW;
M34:=EMA((R+r1)/2,34);
M55:=EMA((R+r1)/2,55);
M89:=EMA((R+r1)/2,89);
M144:=EMA((R+r1)/2,144);
M233:=EMA((R+r1)/2,233);
M377:=EMA((R+r1)/2,377);
黄金线:=Ema((M3+M5+M8+M13+M21+M34+M55)/7,(3+5+8+13+21+34+55)/7);
zlx:=EMA(R*zl,99)/EMA(zl,99),COLORFFC0FF,LINETHICK2,PRECISION2;
lxx:=EMA(R*zl,233)/EMA(zl,233),COLORRED,LINETHICK2,PRECISION2;
MA555:=EMA(R*zl,368)/EMA(zl,368);
MA999:=EMA(R*zl,987)/EMA(zl,987);
行情线:(EMA(DMA(COST(77),0.77),13)+工作线)/2,COLOR6600FF,LINETHICK1;
多空线:=(eMA(DMA((COST(55)),0.55),25)+黄金线)/2,COLORRED,LINETHICK2;
主力线:=(eMA(DMA((COST(33)),0.33),99)+ZLX)/2,COLORFFC0FF,LINETHICK2;
牛熊线:=(eMA(DMA((COST(33)),0.33),233)+LXX)/2,COLORAAAA00;
主力成本线:(eMA(DMA((COST(8)),0.08),368)+MA555)/2,COLORWHITE,LINETHICK2;
Fx:=eMA(主力成本线-(ema(KX,2)-主力成本线),2);
PARTLINE(主力成本线
高杠:if(STKTYPE=0,hhv(行情线,75*3/2),hhv(行情线,52)),COLOR6600FF,PRECISION2,LINEDOT;
低杠:if(STKTYPE=0,llv(行情线,75),LLV(行情线,52)),COLORAAAA00,PRECISION2,LINEDOT;
十字线:(高杠+低杠)/2,COLORWHITE,CROSSDOT,PRECISION2;
PARTLINE(KX<十字线,十字线),COLORCYAN,CROSSDOT;
PARTLINE(KX<高杠,高杠),COLORFFCCAA,LINEDOT;
DIF:=工作线-主力线,COLORRED;
dea:=MA(dif,5),COLORAAAA00;
MACD:=5*(DIF-DEA),LINETHICK;
{LC := REF(均价,1);
RSIA:=SMA(MAX(均价-LC,0),8,1)/SMA(ABS(均价-LC),8,1)*100;
RSIB:=SMA(MAX(均价-LC,0),56,1)/SMA(ABS(均价-LC),56,1)*100;
HR:=REF(HHV(RSIA,28),1);
DRAWTEXT(CROSS(HR,RSIb)and ref(RSIb,1)>65,h*1.02,'警'),COLORRED,ALIGN0;
DRAWTEXT(CROSS(HDIF,DIF) ,h*1.02,'逃'),COLORWHITE,ALIGN0;}
{rcc:=DYNAINFO(3); s22:=sma(c,3,1); s66:=sma(c,5,1);
dk1:=10*(s22-s66); kk:=IF(DATATYPE=8,0.95,1);
STICKLINE(dk1>0,rcc*kk,rcc*kk+dk1,0,1),COLORRED;
STICKLINE(dk1<0,rcc*kk,rcc*kk+dk1,0,1),COLORCYAN;}
////////****** 计算指标变换所需的公共数据 *******
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,COLOR330099,LINETHICK2;//在分时副图1,显示变换后的大盘分时
////////////////////////////////////////////////////////////////
LC := REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),14,1)/SMA(ABS(CLOSE-LC),14,1)*100;
R1:=rsi;
Rh1:=hhv(r1,0);//最大值
RL1:=LLv(r1,0);//最小值
Rb1:=(q1h-q1l)/(RH1[q]-RL1[q]);//缩放比例
Ry1:=(q1h+q1l-rb1*(RH1[q]+RL1[q]))/2;//平移值
rsi14:=r1*rb1+ry1,COLOR00bb00,LINETHICK2;
{PARTLINE(msd
//副图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)/10;
q2l,POINTDOT,,COLORWHITE;
q2l+2*cz,POINTDOT,color0000cc;
q2l+5*cz,POINTDOT,color0000cc;
q2l+8*cz,POINTDOT,color0000cc;
a1:=dif;
a2:=dea;
a3:=macd;
mh:=hhv(max(a1,a3),0);
mL:=LLv(min(a3,a1),0);
mb:=(q2h-q2l)/(mH[q]-mL[q]);
my:=(q2h+q2l-mb*(mH[q]+mL[q]))/2;
diff:a1*mb+my,COLORWHITE,LINETHICK1;
dea0:a2*mb+my,COLORYELLOW,LINETHICK1;
macd0:=a3*mb+my;
STICKLINE(macd0>my,my,macd0,1,1),COLORRED;
STICKLINE(macd0
支撑:llV(REF(dea0,1),5),COLORRED;
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(H,A1+1)