DRAWGBK(C 0,RGB(0,20,100),RGB(80,80,80),0,'12',0);
NG:=12;MG:=26;{按MACD方法设置N,M参数后可删除此行}
BG:=BARSCOUNT(OPEN)+1;
TH:=BG
MIDR:=SQRT(NG*MG);
DIF:=((EMA(C,NG)-EMA(C,MG))/EMA(C,MIDR));{不取绝对值式,推荐}
JD:=MIDR*EMA(1+DIF,MIDR);
{DIF:=ABS((EMA(C,N)-EMA(C,M))/EMA(C,MIDR))*8;}{取绝对值式}
{JD:=MIDR*EMA(1/2+DIF,MIDR);}
Q:=IF(BG =JD,BG,JD);
MA_S:=EMA(C,Q);
CQ:=LN(ABS(C)+1);{取绝对值及加1都为防 负 }
SD:=SQRT(EMA((C-MA_S)*(C-MA_S)*CQ/MA(CQ,Q),Q));
顶线:=IF(TH,H*1.03,MA_S+2*SD)COLORBLUE;
强线:=IF(TH,(3*H+L)/4,MA_S+SD);
中线:=MA_S,LINETHICK1;
弱线:=IF(TH,(3*L+H)/4,MA_S-SD);
底线:=IF(TH,L*0.98,MA_S-2*SD)COLORCYAN;
DRAWBAND(中线,RGB(188,143,123 ),顶线,RGB(168,103,103));
DRAWBAND(中线,RGB(61,89,171 ),底线,RGB(34,139,34));
DRAWBAND(强线,RGB(130,85,100 ),中线,RGB(90,100,90));
DRAWBAND(弱线,RGB(180,185,100 ),中线,RGB(80,120,80));
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
动态周期:Q,NODRAW;
SHORT:=12;LONG:=26;MID:=9;M2:=3;KG:=1;M1:=3;
DFC:=C-REF(C,1);
WJXS:=(LONG-SHORT)/2;
JGL_JF:=WJXS*EMA(DFC,SHORT);
DIF_JIP:=EMA(JGL_JF,LONG),COLOR1188FF,LINETHICK2;
DEA_GEM:=EMA(DIF_JIP,MID),COLORGREEN,LINETHICK2;
K_DF_J:=SMA(JGL_JF,M1,1),COLORFEDCBA;
D_DF_G:=SMA(K_DF_J,M2,1),COLOR13F8F9;
J_DF_L:=2.5*K_DF_J-1.5*D_DF_G,COLORF813F9;
RF:=REF(J_DF_L,1)COLORRED;
{MACD}
N:=18;S:=26;P5:=12;M5:=9;
A2:=EMA(CLOSE,S);
T:=EMA(CLOSE,P5);
B:=EMA(A2,M5);
T1:=EMA(T,M5);
DEA:=EMA(T-(T1-T),2),COLORYELLOW,LINETHICK1;
DIFF:=DEA-EMA(((A2-B)-(T-T1)),1)*6,COLORRED,LINETHICK1;
DF_J:=SMA(JGL_JF,M1,1),COLORFEDCBA;
DF_G:=SMA(K_DF_J,M2,1),COLOR13F8F9;
DF_L:2.5*DF_J-1.5*DF_G,COLORF813F9;
RF1:=REF(DIFF,1),DOTLINE,COLORCYAN;
N1:=SQRT(SHORT*LONG);
NN:=IF(N1 9,9,N1);
BZC:=STD(DFC,NN);
A:=PERIOD;KKH:=DRAWNULL;
TJ1:=(A 1 OR A 6 AND A!=9);
TJ2:=(A 2 OR A 6 AND A!=9);
TJ3:=(A 3 OR A 7 AND A!=9);
TJ4:=(A 4 OR A=8);
TJ5:=(A 5 OR A=8);
{10日盈亏平衡线,根据牛熊界线基准线内插}
N2:=IF(A=5,10,IF(A=6,2,IF(A=9,3,IF(A=4,40,IF(A=3,80,IF(A=2,160,KKH))))));
H10:=IF(TJ1,KKH,IF(CAPITAL,HHV(EMA(H+C,3)/2,N2)*0.933,HHV(EMA(H+C,3)/2,N2)*0.983));
L10H:=IF(TJ1,KKH,IF(CAPITAL,LLV(EMA(L+C,3)/2,N2)*1.067,LLV(EMA(L+C,3)/2,N2)*1.017));
盈亏平衡:IF(TJ1,KKH,(H10+L10H)/2),COLORWHITE,LINETHICK2;
U:=IF(KG=1,K_DF_J+2*BZC,MA(C,25600)),COLORFE9813,CROSSDOT,LINETHICK2;
倍量:=U =2*REF(U,1) AND REF(U,1) =REF(U,2) AND C REF(C,1);
DRAWTEXT(倍量 =1 AND U = REF(U,1),L,' 多'),COLORYELLOW;
STICKLINE(J_DF_L RF,O,C,1.5,0),COLORWHITE;
STICKLINE(J_DF_L RF,O,C,1.8,0),COLOR338833;
STICKLINE(C RF1 AND C DEA,CLOSE,OPEN,3,0),,COLOR000099;
STICKLINE(C RF1 AND C DEA,CLOSE,OPEN,2.2,0),COLOR0000CC;{红K线持股}
STICKLINE(C RF1 AND C DEA,CLOSE,OPEN,0.15,0),COLORCC66FF;
{蓝}
STICKLINE(C DEA,OPEN,(CLOSE+OPEN)/2,3,0),COLORFF7700;
STICKLINE(C DEA,OPEN,(CLOSE+OPEN)/2,2.2,0),COLORFF9900;
STICKLINE(C DEA,OPEN,(CLOSE+OPEN)/2,0.15,0),COLORCYAN;
DRAWTEXT_FIX(1,0.62,0.95,0,'见凌见双布林与K线微积分修改版: '),COLORYELLOW;
DRAWTEXT_FIX(1,0.85,0.97,0,'整理或变盘 '),COLOR338833;
DRAWTEXT_FIX(1,0.85,0.93,0,'小涨或可持'),COLORWHITE;
DRAWTEXT_FIX(1,0.78,0.97,0,'上青 下 跌'),COLORCYAN;
DRAWTEXT_FIX(1,0.78,0.93,0,'全红 上 涨'),COLORRED;
DRAWICON(CROSS(DIFF,RF1),L,1);
DRAWICON(CROSS(RF1,DIFF),H,2);
C2:=REF(C,1),NODRAW;
涨停:=REF(C,1)*1.1-C 0.01 AND H=C,NODRAW;
STICKLINE(涨停,OPEN,CLOSE,0001,0),COLORYELLOW;
STICKLINE(涨停,H,L,0,0),COLORRED;
跌停:=IF((C2-C)*100/C2 =(10-0.01*100/C2) AND L=C,1,0),NODRAW;
STICKLINE(跌停,OPEN,CLOSE,1,0),COLORBLUE;
{超越布林};
M10:=((EMA(C,12)-EMA(C,26))/EMA(C,12)+1)*34,NODRAW;
DIF0:=MA(((EMA(C,12)-EMA(C,26))/EMA(C,12)+1)*C,M10);
{以上式构造动态虽已发表过(作本文备用),但未必最优,玩家还有很大的发挥余地}
MH0:EMA( KDJ.K (9,3,3)/100+ KDJ.D (9,3,3)/100,34)*34,NODRAW;
M_A0:=SUM(C,MH0)/SUM(1,MH0);{此式有利看新股}
{M_A:=MA(C,N);备用,当上市交易日数 =N时与上式等值};
CQ0:=ABS(C);
SD10:=SQRT(SUM((C-M_A0)*(C-M_A0)*CQ0/SUM(CQ0,MH0),MH0));
SD20:=SQRT(SUM((C-M_A0)*(C-M_A0)*CQ0,MH0)/SUM(CQ0,MH0));
SD0:=(SD10+SD20)/2;{其实SD1、SD2无原理性区别,但有个截尾误差}
顶线0:M_A0+2*SD0,COLORGREEN,DOTLINE;
强线0:M_A0+SD0,COLORWHITE,DOTLINE;
中线0:M_A0,LINETHICK2,COLORGREEN;
弱线0:M_A0-SD0,COLORWHITE,DOTLINE;
底线0:M_A0-2*SD0,COLORGREEN,DOTLINE;
DRAWNUMBER(ISLASTBAR,顶线0,顶线0),COLORYELLOW;
DRAWNUMBER(ISLASTBAR,强线0,强线0),COLOR00FF00;
DRAWNUMBER(ISLASTBAR,中线0,中线0),COLORFFFF00;
DRAWNUMBER(ISLASTBAR,弱线0,弱线0),COLORWHITE;
DRAWNUMBER(ISLASTBAR,底线0,底线0),COLOR0099FF;
DEAF:EMA(T-(T1-T),2),COLORYELLOW,LINETHICK2;
REF(J_DF_L,1)COLORRED;
NJ:=0.99;
DIFJ:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEAJ:=EMA(DIFJ,9);
MACDJ:=(DIFJ-DEAJ)*2;
G:=CONST(IF(CURRBARSCOUNT =81,HHV(H,BARSLAST(CURRBARSCOUNT=81)),0));
D:=CONST(IF(CURRBARSCOUNT =81,LLV(L,BARSLAST(CURRBARSCOUNT=81)),0));
STICKLINE(DATE!=REF(DATE,1) AND PERIOD 5,G,D,0,-1)COLORWHITE;
金叉:=REFX(CROSS(DIFJ,DEAJ),1);
DRAWICON(金叉 0,L,11);
DRAWICON(金叉 0,L,5);
中:MA_S,COLORMAGENTA,LINETHICK2;