文华财经K线形态主图指标公式源码:
A1:=ABS(O-C)=HHV(ABS(O-C),20)&&ISUP;
//DRAWCOLORKLINE(A1&&BACKSET(ISLASTBAR,SUMBARS(A1,1)),COLORLIGHTBLUE,0);
DRAWSL(A1&&BACKSET(ISLASTBAR,SUMBARS(A1,1)),L-2*MINPRICE,0,6,0,COLORRED),LINETHICK5;
DRAWTEXT(A1&&BACKSET(ISLASTBAR,SUMBARS(A1,1)),L,'大阳'),VALIGN0,COLORRED,ALIGN2;
//DRAWNUMBER(A1&&BACKSET(ISLASTBAR,SUMBARS(A1,1)),H,L-2*MINPRICE,1,COLORRED);
B1:=ABS(O-C)=HHV(ABS(O-C),20)&&ISDOWN;
//DRAWCOLORKLINE(B1&&BACKSET(ISLASTBAR,SUMBARS(B1,1)),COLORCYAN,0);
DRAWSL(B1&&BACKSET(ISLASTBAR,SUMBARS(B1,1)),H+2*MINPRICE,0,6,0,COLORGREEN),LINETHICK5;
DRAWTEXT(B1&&BACKSET(ISLASTBAR,SUMBARS(B1,1)),L,'大阴'),VALIGN0,COLORGREEN,ALIGN2;
//DRAWNUMBER(B1&&BACKSET(ISLASTBAR,SUMBARS(B1,1)),H,H+2*MINPRICE,1,COLORGREEN);
C1:=V=HHV(V,20)&&ISUP;
D1:=V=HHV(V,20)&&ISDOWN;
//DRAWCOLORKLINE(C1&&BACKSET(ISLASTBAR,SUMBARS(C1,1)),COLORLIGHTBLUE,0);
DRAWSL(C1&&BACKSET(ISLASTBAR,SUMBARS(C1,1)),L-2*MINPRICE,0,6,0,COLORMAGENTA),LINETHICK5;
DRAWTEXT(C1&&BACKSET(ISLASTBAR,SUMBARS(C1,1)),L,'大量阳'),COLORMAGENTA,ALIGN2;
//DRAWNUMBER(C1&&BACKSET(ISLASTBAR,SUMBARS(C1,1)),H,L-2*MINPRICE,1,COLORMAGENTA);
E1:=V=LLV(V,20)&&ISUP;
F1:=V=LLV(V,20)&&ISDOWN;
//DRAWCOLORKLINE(E1&&BACKSET(ISLASTBAR,SUMBARS(E1,1)),COLORLIGHTBLUE,0);
DRAWSL(E1&&BACKSET(ISLASTBAR,SUMBARS(E1,1)),L-2*MINPRICE,0,6,0,RGB(255,128,255));
DRAWTEXT(E1&&BACKSET(ISLASTBAR,SUMBARS(E1,1)),L,'小量阳'),VALIGN0,RGB(255,128,255),ALIGN2;
//DRAWNUMBER(E1&&BACKSET(ISLASTBAR,SUMBARS(E1,1)),H,L-2*MINPRICE,1,RGB(255,128,255));
//DRAWCOLORKLINE(D1&&BACKSET(ISLASTBAR,SUMBARS(D1,1)),COLORCYAN,0);
DRAWSL(D1&&BACKSET(ISLASTBAR,SUMBARS(D1,1)),H+2*MINPRICE,0,6,0,COLORBLUE),LINETHICK5;
DRAWTEXT(D1&&BACKSET(ISLASTBAR,SUMBARS(D1,1)),L,'大量阴'),COLORLIGHTGREEN,ALIGN2;
//DRAWNUMBER(D1&&BACKSET(ISLASTBAR,SUMBARS(D1,1)),H,H+2*MINPRICE,1,COLORBLUE);
//DRAWCOLORKLINE(F1&&BACKSET(ISLASTBAR,SUMBARS(F1,1)),COLORCYAN,0);
DRAWSL(F1&&BACKSET(ISLASTBAR,SUMBARS(F1,1)),H+2*MINPRICE,0,6,0,COLORYELLOW);
DRAWTEXT(F1&&BACKSET(ISLASTBAR,SUMBARS(F1,1)),L,'小量阴'),VALIGN1,COLORYELLOW,ALIGN2;
//DRAWNUMBER(F1&&BACKSET(ISLASTBAR,SUMBARS(F1,1)),H,H+2*MINPRICE,1,COLORYELLOW);
DIF:100*(EMA(CLOSE,10)-EMA(CLOSE,20)),NOTEXT;
DEA:EMA(DIF,5),NOTEXT;
//2*(DIFF-DEA),COLORSTICK;
VID:(DIF-DEA)*2,COLORSTICK,NOTEXT;//MACD柱子COLORSTICK
JC:=CROSS(DIF,DEA);
SC:=CROSSDOWN(DIF,DEA);
N10:=BARSLAST(JC)+1;
N20:=BARSLAST(SC)+1;
HH:=VALUEWHEN(CROSSDOWN(DIF,DEA),HHV(H,N10));//上次MACD红柱期间合约最大值
HH2:=VALUEWHEN(CROSSDOWN(DIF,DEA),REF(HH,1));//上上次MACD红柱期间合约最大值
MHD:=VALUEWHEN(CROSSDOWN(DIF,DEA),HHV(VID,N10));//上次MACD红柱期间MACD最大值
MHD2:=VALUEWHEN(CROSSDOWN(DIF,DEA),REF(MHD,1));//上上次MACD红柱期间MACD最大值
LL:=VALUEWHEN(CROSS(DIF,DEA),LLV(L,N20));//上次MACD绿柱期间合约最小值
LL2:=VALUEWHEN(CROSS(DIF,DEA),REF(LL,1));//上上次MACD绿柱期间合约最小值
MHDD:=VALUEWHEN(CROSSDOWN(DIF,DEA),HHV(DIF,N10));//上次MACD红柱期间DIFF最大值
MHDD2:=VALUEWHEN(CROSSDOWN(DIF,DEA),REF(MHDD,1));//上上次MACD红柱期间DIFF最大值
MLDD:=VALUEWHEN(CROSS(DIF,DEA),LLV(DIF,N20));//上次MACD绿柱期间DIFF最小值
MLDD2:=VALUEWHEN(CROSS(DIF,DEA),REF(MLDD,1));//上上次MACD绿柱期间DIFF最小值
AA0:=CROSSDOWN(DIF,DEA)&&HH>HH2&&MHDD<MHDD2;//顶背离
BB:=CROSS(DIF,DEA)&&LL<LL2&&MLDD>MLDD2;//底背离
DRAWTEXT(AA0,MHDD,'顶背离'),COLORGREEN;
DRAWTEXT(BB,MLDD,'底背离'),VALIGN0,COLORRED;
//DRAWLINE3(AA0,MHDD,HHVBARS(DIF,N10),1,MHDD2,N10+REF(HHVBARS(DIF,N10),N10),0),COLORGREEN,DOT;
//DRAWLINE3(BB,MLDD,LLVBARS(DIF,N20),1,MLDD2,N20+REF(LLVBARS(DIF,N20),N20),0),COLORRED,DOT;
//DRAWICON(JC,DEA,'IC04'),VALIGN0;
//DRAWICON(SC,DEA,'IC05');
//DRAWSHIFTNUMBER(JC,REF(LLV(DIF,SUMBARS(SC,1)),1)*(1+1/10),REF(LLV(DIF,SUMBARS(SC,1)),1),2,COLORRED,0,REF(LLVBARS(DIF,SUMBARS(SC,1)),1)+1),VALIGN0;
//DRAWSHIFTNUMBER(SC,REF(HHV(DIF,SUMBARS(JC,1)),1)*(1+1/10),REF(HHV(DIF,SUMBARS(JC,1)),1),2,COLORGREEN,0,REF(HHVBARS(DIF,SUMBARS(JC,1)),1)+1);
MLD:=VALUEWHEN(CROSS(DIF,DEA),LLV(DIF,N20));//
MLD2:=VALUEWHEN(CROSS(DIF,DEA),REF(MLD,1));//
B0:=CROSS(DIF,DEA)&&LL<LL2&&MLD>MLD2;//底背离
A:=CROSSDOWN(DIF,DEA)&&HH>HH2&&MHD<MHD2;//顶背离
DRAWLINE3(B0,REF(DIF,LLVBARS(DIF,N20)),LLVBARS(DIF,N20),1,REF(LLV(DIF,N20),SUMBARS(JC,2)),REF(LLVBARS(DIF,N20),SUMBARS(JC,2))+SUMBARS(JC,2),0),COLORMAGENTA;
DRAWLINE3(A,REF(DIF,HHVBARS(DIF,N10)),HHVBARS(DIF,N10),1,REF(HHV(DIF,N10),SUMBARS(SC,2)),REF(HHVBARS(DIF,N10),SUMBARS(SC,2))+SUMBARS(SC,2),0),COLORGREEN;
KTEXT(B0,-LLVBARS(DIF,N20),LLV(DIF,N20),1,COLORYELLOW,'低');
KTEXT(A,-HHVBARS(DIF,N10),HHV(DIF,N10),1,COLORYELLOW,'顶');
DRAWHORIZONTALLINE(DEA>REF(DEA,1)&&DEA>REFX(DEA,1)&&BACKSET(ISLASTBAR,BARSLAST(DEA>REF(DEA,1)&&DEA>REFX(DEA,1))+1),DEA,COLORRED),LINETHICK3;
DRAWHORIZONTALLINE(DEA<REF(DEA,1)&&DEA<REFX(DEA,1)&&BACKSET(ISLASTBAR,BARSLAST(DEA<REF(DEA,1)&&DEA<REFX(DEA,1))+1),DEA,COLORGREEN),LINETHICK3;
WR:-100*(HHV(HIGH,14)-CLOSE)/(HHV(HIGH,14)-LLV(LOW,14)),NODRAW;
DRAWTEXT(CROSS(WR,-50)&&BACKSET(ISLASTBAR,SUMBARS(CROSS(WR,-50),1)),WR,'D'),COLORRED,VALIGN0,FONTSIZE30;
DRAWTEXT(CROSSDOWN(WR,-50)&&BACKSET(ISLASTBAR,SUMBARS(CROSSDOWN(WR,-50),1)),WR,'K'),COLORGREEN,FONTSIZE30;
添加图片注释,不超过 140 字(可选)