请老师改成博弈指标 [博易POBO]
咨询内容:
DEA : =EMA(DIFF,9),COLORYELLOW;
MACD := 2*(DIFF-DEA),COLORYELLOW;
MACDMA:=EMA(MACD,3),COLORMAGENTA,LINETHICK1;
RMACD:=REF(MACD,1);
0,COLORYELLOW,NOTEXT,LINETHICK1;
STICKLINE(MACD>REF(MACD,1) AND MACD>=0,MACD,0,COLORRED,0);//柱壮0上红色
STICKLINE(MACD>REF(MACD,1) AND MACD<0,MACD,0,COLORMAGENTA,0);
STICKLINE(NOT(MACD>REF(MACD,1)) AND MACD>=0,MACD,0,COLORBLUE,0);//柱壮0上红色
STICKLINE(NOT(MACD>REF(MACD,1)) AND MACD<0,MACD,0,COLORGREEN,0);
//JC:=CROSS(DIFF,DEA);
//SC:=CROSSDOWN(MACD,REF(MACD,1))&&MACD>0;
//N1:=BARSLAST(JC)+1;
//N2:=BARSLAST(SC)+1;
//HH:=VALUEWHEN(SC,REF(H,1));//上次MACD红柱期间合约最大值
//HH2:=VALUEWHEN(SC,REF(HH,1));//上上次MACD红柱期间合约最大值
//MHD:=VALUEWHEN(SC,REF(MACD,1));//上次MACD红柱期间MACD最大值
//MHD2:=VALUEWHEN(SC,REF(MHD,1));//上上次MACD红柱期间MACD最大值
//A:=SC&&HH>HH2&&MHD<MHD2&&SUMBARS(SC,2)<BARSLAST(CROSS(MACD,0));//顶背离
//DRAWICON(A,MACD,'ICO96');
//LL:=VALUEWHEN(CROSS(DIFF,DEA),LLV(L,N2));//上次MACD绿柱期间合约最小值
//LL2:=VALUEWHEN(CROSS(DIFF,DEA),REF(LL,1));//上上次MACD绿柱期间合约最小值
//MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(MACD,N2));//上次MACD绿柱期间MACD最小值
//MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));//上上次MACD绿柱期间MACD最小值
//B:=CROSS(DIFF,DEA)&&LL<LL2&&MLD>MLD2;//底背离
//DRAWICON(B,MACD,'ICO95');
ZIGZAG(MACD,100,1),COLORCYAN,LINETHICK3; //青色折线
J:=CROSS(DIFF,DEA);
S:=CROSSDOWN(DIFF,DEA);
//DIFF : EMA(CLOSE,12) - EMA(CLOSE,26);
//DEA : EMA(DIFF,9);
AT:=2*(DIFF-DEA),COLORSTICK,NOTEXT;
MACDD:IF(AT>0,AT,NULL),COLORRED,NODRAW;
MACDD.:IF(AT<0,AT,NULL),COLORGREEN,NODRAW;
DRAWNUMBER(ISLASTBAR&&AT>0,AT,AT,2,COLORLIGHTRED),ALIGN0,FONTSIZE30,VALIGN1;
DRAWNUMBER(ISLASTBAR&&AT<0,AT,AT,2,COLORLIGHTGREEN),ALIGN0,FONTSIZE30,VALIGN1;
//DRAWCOLORLINE(MACD>REF(MACD,1),DIFF,COLORRED,COLORGREEN),LINETHICK4;
VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD>0),REF(VA1,1)+2),0.5);
P:=BACKSET(ISLASTBAR,SUMBARS(VA2,1));
VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);
VA4:=CROSS(BACKSET(CROSS(MACD,0) OR (ISLASTBAR AND MACD<0),REF(VA3,1)+2),0.5);
Q:=BACKSET(ISLASTBAR,SUMBARS(VA4,1));
AAX:=CROSS(BACKSET(REFX(J,1),LLVBARS(MACD,BARSLAST(S))+1),0.5),NODRAW;
BBX:=CROSS(BACKSET(REFX(S,1),HHVBARS(MACD,BARSLAST(J))+1),0.5),NODRAW;
//VERTLINE( AAX,COLORYELLOW),LINETHICK3;
//VERTLINE( BBX,COLORBLUE),LINETHICK3;
XX:=BACKSET(ISLASTBAR,BARSLAST(AAX||BBX)+1);
//DRAWGBK1(XX&&BARSLAST(AAX)<BARSLAST(BBX),COLORLIGHTRED);
//DRAWGBK1(XX&&BARSLAST(AAX)>BARSLAST(BBX),COLORLIGHTGREEN);
//DRAWGBK1(P,RGB(48,111,43));
//DRAWGBK1(Q,RGB(128,0,64));
VERTLINE(CROSS(Q,0.5),COLORMAGENTA),DASH;//紫色垂直虚线
VERTLINE(CROSS(P,0.5),COLORBLUE),DASH;//蓝色垂直虚线
//DRAWGBK1(P&&Q&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),RGB(48,111,43));
//DRAWGBK1(Q&&P&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),RGB(128,0,64));
DRAWSL(ISLASTBAR&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),0,-BARSLASTCOUNT(P)+1,0,COLORWHITE),LINETHICK3;
DRAWSL(ISLASTBAR&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),0,-BARSLASTCOUNT(Q)+1,0,COLORWHITE),LINETHICK3;
DRAWLINE3(ISLASTBAR&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),BARSLASTCOUNT(Q)-1,1,VALUEWHEN(VA2,MACD),BARSLASTCOUNT(P)-1,0),COLORWHITE,LINETHICK3;
DRAWLINE3(ISLASTBAR&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),BARSLASTCOUNT(P)-1,1,VALUEWHEN(VA4,MACD),BARSLASTCOUNT(Q)-1,0),COLORWHITE,LINETHICK3;
//DRAWNUMBER(P&&(REFX(VA2,1)||ISLASTBAR)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),VALUEWHEN(VA2,MACD),2,COLORWHITE),FONTSIZE24,ALIGN2,VALIGN0;
//DRAWNUMBER(Q&&(REFX(VA4,1)||ISLASTBAR)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),VALUEWHEN(VA4,MACD),2,COLORBLUE),FONTSIZE24,VALIGN2,ALIGN2;
//DRAWNUMBER(P&&NOT(Q)&&REFX(Q,1),VALUEWHEN(VA2,MACD),VALUEWHEN(VA2,MACD),2,COLORWHITE),FONTSIZE24,ALIGN2,VALIGN0;
//DRAWNUMBER(Q&&NOT(P)&&REFX(P,1),VALUEWHEN(VA4,MACD),VALUEWHEN(VA4,MACD),2,COLORBLUE),FONTSIZE24,VALIGN2,ALIGN2;
B11:=BACKSET(ISLASTBAR&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),BARSLASTCOUNT(P));
Y1:=BACKSET(ISLASTBAR&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),BARSLASTCOUNT(Q));
YY:=AAX||B11&&REF(ISNULL(B11),1);
BB:=BBX||Y1&&REF(ISNULL(Y1),1);
XX1:=BACKSET(ISLASTBAR,SUMBARS(YY||BB,2));
//VERTLINE(XX1&&AAX,COLORMAGENTA),DASH;//紫色垂直虚线(对应K线图虚线)
//VERTLINE(XX1&&BBX,COLORBLUE),DASH;//蓝色垂直虚线(对应K线图虚线)
VERTLINE(XX1&&B11&&REF(ISNULL(B11),1),COLORBLUE),DASH;//蓝色垂直虚线
VERTLINE(XX1&&Y1&&REF(ISNULL(Y1),1),COLORMAGENTA),DASH;//紫色垂直虚线
TT:=BACKSET(ISLASTBAR,MAX(SUMBARS(VA2,1),SUMBARS(VA4,1)));
//DRAWNUMBER(TT&&VA2,MACD,MACD,2,COLORWHITE),FONTSIZE30,ALIGN2,VALIGN1;
//DRAWNUMBER(TT&&VA4,MACD,MACD,2,COLORYELLOW),FONTSIZE30,ALIGN2,VALIGN1;
//DRAWTEXT(CROSS(P,0.5)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
DRAWTEXT(CROSS(Q,0.5)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORRED,FONTSIZE30;
DRAWTEXT(CROSS(P,0.5)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORGREEN,FONTSIZE20;
//DRAWTEXT(CROSS(Q,0.5)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
DRAWTEXT(BARSLASTCOUNT(P)<BARSLASTCOUNT(Q)&&CROSS(P,0.5),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORGREEN,FONTSIZE30;
DRAWTEXT(BARSLASTCOUNT(P)>BARSLASTCOUNT(Q)&&CROSS(Q,0.5),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
FROMOPEN:=IF(HOUR<12,60*(HOUR-9)-30+MINUTE,120+60*(HOUR-13)+MINUTE);
VAR1:=(2*CLOSE+HIGH+LOW)/40;
VAR2:=EMA(EMA(EMA(VAR1,4),4),4);
J1:(VAR2-REF(VAR2,1))/REF(VAR2,1)*100, COLORSTICK,NOTEXT;
D:=MA(J1,3);
K:=MA(J1,1);
PW1:=EMA(((VOL*(CLOSE-OPEN)*240/FROMOPEN)/(CLOSE+OPEN)),38);
ME:=EMA(PW1,8)*0.1,COLORSTICK;
MEE:=ABS(J1);
V10:=PEAKBARS(C,15,1,0)<10;
V12:=IF(V10=1,50,0);
头部:=IF(V12=50,100,0);
TOB:=J1<=REF(J1,1) OR K<=D;
卖:=IF(头部>REF(头部,1),MEE,0),COLORGREEN,LINETHICK3;
V9:=TROUGHBARS(C,15,1,0)<10;
V11:=IF(V9=1,50,0);
底部:=IF(V11=50,50,0);
买底:=IF(底部>REF(底部,1),MEE,0),COLORRED,LINETHICK2;
STICKLINE1(买底,0,MEE*0.9,1,0),COLORRED;
STICKLINE1(卖,0,MEE*0.9,1,0),COLORBLUE;
STICKLINE1(卖,0,MEE*0.9,0.6,0),COLORWHITE;
DRAWTEXT(底部>REF(底部,1),MACD,'底买'),COLORYELLOW,FONTSIZE30,VALIGN0;
DRAWTEXT(头部>REF(头部,1),MACD,'顶卖'),COLORWHITE,FONTSIZE30,VALIGN2;
//DRAWTEXT(头部>REF(头部,1),MEE*1.04,'▲'),COLORMAGENTA;
//DRAWTEXT(头部>REF(头部,1),MEE*1.08,'▲'),COLORLIGHTGREEN;
DEA :=EMA(DIFF,9),COLORYELLOW;
MACD := 2*(DIFF-DEA),COLORYELLOW;
MACDMA:=EMA(MACD,3),COLORMAGENTA,LINETHICK1;
RMACD:=REF(MACD,1);
0,COLORYELLOW,LINETHICK1;
STICKLINE(MACD>REF(MACD,1) AND MACD>=0,MACD,0,10,0),COLORRED;//柱壮0上红色
STICKLINE(MACD>REF(MACD,1) AND MACD<0,MACD,0,10,0),COLORMAGENTA;
STICKLINE(NOT(MACD>REF(MACD,1)) AND MACD>=0,MACD,0,10,0),COLORBLUE;//柱壮0上红色
STICKLINE(NOT(MACD>REF(MACD,1)) AND MACD<0,MACD,0,10,0),COLORGREEN;
//JC:=CROSS(DIFF,DEA);
//SC:=CROSSDOWN(MACD,REF(MACD,1))&&MACD>0;
//N1:=BARSLAST(JC)+1;
//N2:=BARSLAST(SC)+1;
//HH:=VALUEWHEN(SC,REF(H,1));//上次MACD红柱期间合约最大值
//HH2:=VALUEWHEN(SC,REF(HH,1));//上上次MACD红柱期间合约最大值
//MHD:=VALUEWHEN(SC,REF(MACD,1));//上次MACD红柱期间MACD最大值
//MHD2:=VALUEWHEN(SC,REF(MHD,1));//上上次MACD红柱期间MACD最大值
//A:=SC&&HH>HH2&&MHD<MHD2&&SUMBARS(SC,2)<BARSLAST(CROSS(MACD,0));//顶背离
//DRAWICON(A,MACD,'ICO96');
//LL:=VALUEWHEN(CROSS(DIFF,DEA),LLV(L,N2));//上次MACD绿柱期间合约最小值
//LL2:=VALUEWHEN(CROSS(DIFF,DEA),REF(LL,1));//上上次MACD绿柱期间合约最小值
//MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(MACD,N2));//上次MACD绿柱期间MACD最小值
//MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));//上上次MACD绿柱期间MACD最小值
//B:=CROSS(DIFF,DEA)&&LL<LL2&&MLD>MLD2;//底背离
//DRAWICON(B,MACD,'ICO95');
//ZIG(MACD,100,1),COLORCYAN,LINETHICK3; //青色折线
J:=CROSS(DIFF,DEA);
S:=CROSS(DEA,DIFF);
//DIFF : EMA(CLOSE,12) - EMA(CLOSE,26);
//DEA : EMA(DIFF,9);
AT:=2*(DIFF-DEA),COLORSTICK;
MACDD:IF(AT>0,AT,DRAWNULL),COLORRED,NODRAW;
MACDD1:IF(AT<0,AT,DRAWNULL),COLORGREEN,NODRAW;
DRAWNUMBER(ISLASTBAR&&AT>0,AT,AT,2),COLORRED,ALIGN0,FONTSIZE15,VALIGN1;
DRAWNUMBER(ISLASTBAR&&AT<0,AT,AT,2),COLORGREEN,ALIGN0,FONTSIZE15,VALIGN1;
//DRAWCOLORLINE(MACD>REF(MACD,1),DIFF,COLORRED,COLORGREEN),LINETHICK4;
VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD>0),REF(VA1,1)+2),0.5);
P:=BACKSET(ISLASTBAR,SUMBARS(VA2,1));
VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);
VA4:=CROSS(BACKSET(CROSS(MACD,0) OR (ISLASTBAR AND MACD<0),REF(VA3,1)+2),0.5);
Q:=BACKSET(ISLASTBAR,SUMBARS(VA4,1));
AAX:=CROSS(BACKSET(REFX(J,1),LLVBARS(MACD,BARSLAST(S))+1),0.5),NODRAW;
BBX:=CROSS(BACKSET(REFX(S,1),HHVBARS(MACD,BARSLAST(J))+1),0.5),NODRAW;
//VERTLINE( AAX,COLORYELLOW),LINETHICK3;
//VERTLINE( BBX,COLORBLUE),LINETHICK3;
XX:=BACKSET(ISLASTBAR,BARSLAST(AAX||BBX)+1);
//DRAWGBK1(XX&&BARSLAST(AAX)<BARSLAST(BBX),COLORLIGHTRED);
//DRAWGBK1(XX&&BARSLAST(AAX)>BARSLAST(BBX),COLORLIGHTGREEN);
//DRAWGBK1(P,RGB(48,111,43));
//DRAWGBK1(Q,RGB(128,0,64));
VERTLINE(CROSS(Q,0.5),COLORMAGENTA),DASH;//紫色垂直虚线
VERTLINE(CROSS(P,0.5),COLORBLUE),DASH;//蓝色垂直虚线
//DRAWGBK1(P&&Q&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),RGB(48,111,43));
//DRAWGBK1(Q&&P&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),RGB(128,0,64));
DRAWSL(ISLASTBAR&&BARSLAST(P)<BARSLAST(Q),VALUEWHEN(VA2,MACD),0,BARSLAST(P)+1,1),COLORWHITE,LINETHICK3;
DRAWSL(ISLASTBAR&&BARSLAST(P)>BARSLAST(Q),VALUEWHEN(VA4,MACD),0,BARSLAST(Q)+1,1),COLORWHITE,LINETHICK3;
//DRAWNUMBER(P&&(REFX(VA2,1)||ISLASTBAR)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),VALUEWHEN(VA2,MACD),2,COLORWHITE),FONTSIZE24,ALIGN2,VALIGN0;
//DRAWNUMBER(Q&&(REFX(VA4,1)||ISLASTBAR)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),VALUEWHEN(VA4,MACD),2,COLORBLUE),FONTSIZE24,VALIGN2,ALIGN2;
//DRAWNUMBER(P&&NOT(Q)&&REFX(Q,1),VALUEWHEN(VA2,MACD),VALUEWHEN(VA2,MACD),2,COLORWHITE),FONTSIZE24,ALIGN2,VALIGN0;
//DRAWNUMBER(Q&&NOT(P)&&REFX(P,1),VALUEWHEN(VA4,MACD),VALUEWHEN(VA4,MACD),2,COLORBLUE),FONTSIZE24,VALIGN2,ALIGN2;
B11:=BACKSET(ISLASTBAR&&BARSLAST(P)<BARSLAST(Q),BARSLAST(P));
Y1:=BACKSET(ISLASTBAR&&BARSLAST(P)>BARSLAST(Q),BARSLAST(Q));
YY:=AAX||B11&&REF(NOT(B11),1);
BB:=BBX||Y1&&REF(NOT(Y1),1);
XX1:=BACKSET(ISLASTBAR,SUMBARS(YY||BB,2));
//VERTLINE(XX1&&AAX,COLORMAGENTA),DASH;//紫色垂直虚线(对应K线图虚线)
//VERTLINE(XX1&&BBX,COLORBLUE),DASH;//蓝色垂直虚线(对应K线图虚线)
VERTLINE(XX1&&B11&&REF(NOT(B11),1),COLORBLUE),DASH;//蓝色垂直虚线
VERTLINE(XX1&&Y1&&REF(NOT(Y1),1),COLORMAGENTA),DASH;//紫色垂直虚线
TT:=BACKSET(ISLASTBAR,MAX(SUMBARS(VA2,1),SUMBARS(VA4,1)));
//DRAWNUMBER(TT&&VA2,MACD,MACD,2,COLORWHITE),FONTSIZE30,ALIGN2,VALIGN1;
//DRAWNUMBER(TT&&VA4,MACD,MACD,2,COLORYELLOW),FONTSIZE30,ALIGN2,VALIGN1;
//DRAWTEXT(CROSS(P,0.5)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
DRAWTEXT(CROSS(Q,0.5)&&BARSLAST(P)<BARSLAST(Q),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORRED,FONTSIZE30;
DRAWTEXT(CROSS(P,0.5)&&BARSLAST(P)>BARSLAST(Q),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORGREEN,FONTSIZE20;
//DRAWTEXT(CROSS(Q,0.5)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
DRAWTEXT(BARSLAST(P)<BARSLAST(Q)&&CROSS(P,0.5),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORGREEN,FONTSIZE30;
DRAWTEXT(BARSLAST(P)>BARSLAST(Q)&&CROSS(Q,0.5),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
FROMOPEN:=IF(HOUR<12,60*(HOUR-9)-30+MINUTE,120+60*(HOUR-13)+MINUTE);
VAR1:=(2*CLOSE+HIGH+LOW)/40;
VAR2:=EMA(EMA(EMA(VAR1,4),4),4);
J1:(VAR2-REF(VAR2,1))/REF(VAR2,1)*100, COLORSTICK;
D:=MA(J1,3);
K:=MA(J1,1);
PW1:=EMA(((VOL*(CLOSE-OPEN)*240/FROMOPEN)/(CLOSE+OPEN)),38);
ME:=EMA(PW1,8)*0.1,COLORSTICK;
MEE:=ABS(J1);
V10:=PEAKBARS(C,15,1,0)<10;
V12:=IF(V10=1,50,0);
头部:=IF(V12=50,100,0);
TOB:=J1<=REF(J1,1) OR K<=D;
卖:=IF(头部>REF(头部,1),MEE,0),COLORGREEN,LINETHICK3;
V9:=TROUGHBARS(C,15,1,0)<10;
V11:=IF(V9=1,50,0);
底部:=IF(V11=50,50,0);
买底:=IF(底部>REF(底部,1),MEE,0),COLORRED,LINETHICK2;
STICKLINE(买底,0,MEE*0.9,1,0),COLORRED;
STICKLINE(卖,0,MEE*0.9,1,0),COLORBLUE;
STICKLINE(卖,0,MEE*0.9,0.6,0),COLORWHITE;
DRAWTEXT(底部>REF(底部,1),MACD,'底买'),COLORYELLOW,FONTSIZE15,VALIGN0;
DRAWTEXT(头部>REF(头部,1),MACD,'顶卖'),COLORWHITE,FONTSIZE15,VALIGN2;
//DRAWTEXT(头部>REF(头部,1),MEE*1.04,'▲'),COLORMAGENTA;
//DRAWTEXT(头部>REF(头部,1),MEE*1.08,'▲'),COLORLIGHTGREEN; 谢谢老师,咋没有蓝折线
来源 程序化久久网
请老师改成博弈指标
DIFF:=(EMA(C,12)-EMA(C,26)),COLORWHITE;DEA : =EMA(DIFF,9),COLORYELLOW;
MACD := 2*(DIFF-DEA),COLORYELLOW;
MACDMA:=EMA(MACD,3),COLORMAGENTA,LINETHICK1;
RMACD:=REF(MACD,1);
0,COLORYELLOW,NOTEXT,LINETHICK1;
STICKLINE(MACD>REF(MACD,1) AND MACD>=0,MACD,0,COLORRED,0);//柱壮0上红色
STICKLINE(MACD>REF(MACD,1) AND MACD<0,MACD,0,COLORMAGENTA,0);
STICKLINE(NOT(MACD>REF(MACD,1)) AND MACD>=0,MACD,0,COLORBLUE,0);//柱壮0上红色
STICKLINE(NOT(MACD>REF(MACD,1)) AND MACD<0,MACD,0,COLORGREEN,0);
//JC:=CROSS(DIFF,DEA);
//SC:=CROSSDOWN(MACD,REF(MACD,1))&&MACD>0;
//N1:=BARSLAST(JC)+1;
//N2:=BARSLAST(SC)+1;
//HH:=VALUEWHEN(SC,REF(H,1));//上次MACD红柱期间合约最大值
//HH2:=VALUEWHEN(SC,REF(HH,1));//上上次MACD红柱期间合约最大值
//MHD:=VALUEWHEN(SC,REF(MACD,1));//上次MACD红柱期间MACD最大值
//MHD2:=VALUEWHEN(SC,REF(MHD,1));//上上次MACD红柱期间MACD最大值
//A:=SC&&HH>HH2&&MHD<MHD2&&SUMBARS(SC,2)<BARSLAST(CROSS(MACD,0));//顶背离
//DRAWICON(A,MACD,'ICO96');
//LL:=VALUEWHEN(CROSS(DIFF,DEA),LLV(L,N2));//上次MACD绿柱期间合约最小值
//LL2:=VALUEWHEN(CROSS(DIFF,DEA),REF(LL,1));//上上次MACD绿柱期间合约最小值
//MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(MACD,N2));//上次MACD绿柱期间MACD最小值
//MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));//上上次MACD绿柱期间MACD最小值
//B:=CROSS(DIFF,DEA)&&LL<LL2&&MLD>MLD2;//底背离
//DRAWICON(B,MACD,'ICO95');
ZIGZAG(MACD,100,1),COLORCYAN,LINETHICK3; //青色折线
J:=CROSS(DIFF,DEA);
S:=CROSSDOWN(DIFF,DEA);
//DIFF : EMA(CLOSE,12) - EMA(CLOSE,26);
//DEA : EMA(DIFF,9);
AT:=2*(DIFF-DEA),COLORSTICK,NOTEXT;
MACDD:IF(AT>0,AT,NULL),COLORRED,NODRAW;
MACDD.:IF(AT<0,AT,NULL),COLORGREEN,NODRAW;
DRAWNUMBER(ISLASTBAR&&AT>0,AT,AT,2,COLORLIGHTRED),ALIGN0,FONTSIZE30,VALIGN1;
DRAWNUMBER(ISLASTBAR&&AT<0,AT,AT,2,COLORLIGHTGREEN),ALIGN0,FONTSIZE30,VALIGN1;
//DRAWCOLORLINE(MACD>REF(MACD,1),DIFF,COLORRED,COLORGREEN),LINETHICK4;
VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD>0),REF(VA1,1)+2),0.5);
P:=BACKSET(ISLASTBAR,SUMBARS(VA2,1));
VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);
VA4:=CROSS(BACKSET(CROSS(MACD,0) OR (ISLASTBAR AND MACD<0),REF(VA3,1)+2),0.5);
Q:=BACKSET(ISLASTBAR,SUMBARS(VA4,1));
AAX:=CROSS(BACKSET(REFX(J,1),LLVBARS(MACD,BARSLAST(S))+1),0.5),NODRAW;
BBX:=CROSS(BACKSET(REFX(S,1),HHVBARS(MACD,BARSLAST(J))+1),0.5),NODRAW;
//VERTLINE( AAX,COLORYELLOW),LINETHICK3;
//VERTLINE( BBX,COLORBLUE),LINETHICK3;
XX:=BACKSET(ISLASTBAR,BARSLAST(AAX||BBX)+1);
//DRAWGBK1(XX&&BARSLAST(AAX)<BARSLAST(BBX),COLORLIGHTRED);
//DRAWGBK1(XX&&BARSLAST(AAX)>BARSLAST(BBX),COLORLIGHTGREEN);
//DRAWGBK1(P,RGB(48,111,43));
//DRAWGBK1(Q,RGB(128,0,64));
VERTLINE(CROSS(Q,0.5),COLORMAGENTA),DASH;//紫色垂直虚线
VERTLINE(CROSS(P,0.5),COLORBLUE),DASH;//蓝色垂直虚线
//DRAWGBK1(P&&Q&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),RGB(48,111,43));
//DRAWGBK1(Q&&P&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),RGB(128,0,64));
DRAWSL(ISLASTBAR&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),0,-BARSLASTCOUNT(P)+1,0,COLORWHITE),LINETHICK3;
DRAWSL(ISLASTBAR&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),0,-BARSLASTCOUNT(Q)+1,0,COLORWHITE),LINETHICK3;
DRAWLINE3(ISLASTBAR&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),BARSLASTCOUNT(Q)-1,1,VALUEWHEN(VA2,MACD),BARSLASTCOUNT(P)-1,0),COLORWHITE,LINETHICK3;
DRAWLINE3(ISLASTBAR&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),BARSLASTCOUNT(P)-1,1,VALUEWHEN(VA4,MACD),BARSLASTCOUNT(Q)-1,0),COLORWHITE,LINETHICK3;
//DRAWNUMBER(P&&(REFX(VA2,1)||ISLASTBAR)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),VALUEWHEN(VA2,MACD),2,COLORWHITE),FONTSIZE24,ALIGN2,VALIGN0;
//DRAWNUMBER(Q&&(REFX(VA4,1)||ISLASTBAR)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),VALUEWHEN(VA4,MACD),2,COLORBLUE),FONTSIZE24,VALIGN2,ALIGN2;
//DRAWNUMBER(P&&NOT(Q)&&REFX(Q,1),VALUEWHEN(VA2,MACD),VALUEWHEN(VA2,MACD),2,COLORWHITE),FONTSIZE24,ALIGN2,VALIGN0;
//DRAWNUMBER(Q&&NOT(P)&&REFX(P,1),VALUEWHEN(VA4,MACD),VALUEWHEN(VA4,MACD),2,COLORBLUE),FONTSIZE24,VALIGN2,ALIGN2;
B11:=BACKSET(ISLASTBAR&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),BARSLASTCOUNT(P));
Y1:=BACKSET(ISLASTBAR&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),BARSLASTCOUNT(Q));
YY:=AAX||B11&&REF(ISNULL(B11),1);
BB:=BBX||Y1&&REF(ISNULL(Y1),1);
XX1:=BACKSET(ISLASTBAR,SUMBARS(YY||BB,2));
//VERTLINE(XX1&&AAX,COLORMAGENTA),DASH;//紫色垂直虚线(对应K线图虚线)
//VERTLINE(XX1&&BBX,COLORBLUE),DASH;//蓝色垂直虚线(对应K线图虚线)
VERTLINE(XX1&&B11&&REF(ISNULL(B11),1),COLORBLUE),DASH;//蓝色垂直虚线
VERTLINE(XX1&&Y1&&REF(ISNULL(Y1),1),COLORMAGENTA),DASH;//紫色垂直虚线
TT:=BACKSET(ISLASTBAR,MAX(SUMBARS(VA2,1),SUMBARS(VA4,1)));
//DRAWNUMBER(TT&&VA2,MACD,MACD,2,COLORWHITE),FONTSIZE30,ALIGN2,VALIGN1;
//DRAWNUMBER(TT&&VA4,MACD,MACD,2,COLORYELLOW),FONTSIZE30,ALIGN2,VALIGN1;
//DRAWTEXT(CROSS(P,0.5)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
DRAWTEXT(CROSS(Q,0.5)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORRED,FONTSIZE30;
DRAWTEXT(CROSS(P,0.5)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORGREEN,FONTSIZE20;
//DRAWTEXT(CROSS(Q,0.5)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
DRAWTEXT(BARSLASTCOUNT(P)<BARSLASTCOUNT(Q)&&CROSS(P,0.5),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORGREEN,FONTSIZE30;
DRAWTEXT(BARSLASTCOUNT(P)>BARSLASTCOUNT(Q)&&CROSS(Q,0.5),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
FROMOPEN:=IF(HOUR<12,60*(HOUR-9)-30+MINUTE,120+60*(HOUR-13)+MINUTE);
VAR1:=(2*CLOSE+HIGH+LOW)/40;
VAR2:=EMA(EMA(EMA(VAR1,4),4),4);
J1:(VAR2-REF(VAR2,1))/REF(VAR2,1)*100, COLORSTICK,NOTEXT;
D:=MA(J1,3);
K:=MA(J1,1);
PW1:=EMA(((VOL*(CLOSE-OPEN)*240/FROMOPEN)/(CLOSE+OPEN)),38);
ME:=EMA(PW1,8)*0.1,COLORSTICK;
MEE:=ABS(J1);
V10:=PEAKBARS(C,15,1,0)<10;
V12:=IF(V10=1,50,0);
头部:=IF(V12=50,100,0);
TOB:=J1<=REF(J1,1) OR K<=D;
卖:=IF(头部>REF(头部,1),MEE,0),COLORGREEN,LINETHICK3;
V9:=TROUGHBARS(C,15,1,0)<10;
V11:=IF(V9=1,50,0);
底部:=IF(V11=50,50,0);
买底:=IF(底部>REF(底部,1),MEE,0),COLORRED,LINETHICK2;
STICKLINE1(买底,0,MEE*0.9,1,0),COLORRED;
STICKLINE1(卖,0,MEE*0.9,1,0),COLORBLUE;
STICKLINE1(卖,0,MEE*0.9,0.6,0),COLORWHITE;
DRAWTEXT(底部>REF(底部,1),MACD,'底买'),COLORYELLOW,FONTSIZE30,VALIGN0;
DRAWTEXT(头部>REF(头部,1),MACD,'顶卖'),COLORWHITE,FONTSIZE30,VALIGN2;
//DRAWTEXT(头部>REF(头部,1),MEE*1.04,'▲'),COLORMAGENTA;
//DRAWTEXT(头部>REF(头部,1),MEE*1.08,'▲'),COLORLIGHTGREEN;
来源:程序化99网( WWW.CXH99.COM )
博易技术人员: DIFF:=(EMA(C,12)-EMA(C,26)),COLORWHITE;DEA :=EMA(DIFF,9),COLORYELLOW;
MACD := 2*(DIFF-DEA),COLORYELLOW;
MACDMA:=EMA(MACD,3),COLORMAGENTA,LINETHICK1;
RMACD:=REF(MACD,1);
0,COLORYELLOW,LINETHICK1;
STICKLINE(MACD>REF(MACD,1) AND MACD>=0,MACD,0,10,0),COLORRED;//柱壮0上红色
STICKLINE(MACD>REF(MACD,1) AND MACD<0,MACD,0,10,0),COLORMAGENTA;
STICKLINE(NOT(MACD>REF(MACD,1)) AND MACD>=0,MACD,0,10,0),COLORBLUE;//柱壮0上红色
STICKLINE(NOT(MACD>REF(MACD,1)) AND MACD<0,MACD,0,10,0),COLORGREEN;
//JC:=CROSS(DIFF,DEA);
//SC:=CROSSDOWN(MACD,REF(MACD,1))&&MACD>0;
//N1:=BARSLAST(JC)+1;
//N2:=BARSLAST(SC)+1;
//HH:=VALUEWHEN(SC,REF(H,1));//上次MACD红柱期间合约最大值
//HH2:=VALUEWHEN(SC,REF(HH,1));//上上次MACD红柱期间合约最大值
//MHD:=VALUEWHEN(SC,REF(MACD,1));//上次MACD红柱期间MACD最大值
//MHD2:=VALUEWHEN(SC,REF(MHD,1));//上上次MACD红柱期间MACD最大值
//A:=SC&&HH>HH2&&MHD<MHD2&&SUMBARS(SC,2)<BARSLAST(CROSS(MACD,0));//顶背离
//DRAWICON(A,MACD,'ICO96');
//LL:=VALUEWHEN(CROSS(DIFF,DEA),LLV(L,N2));//上次MACD绿柱期间合约最小值
//LL2:=VALUEWHEN(CROSS(DIFF,DEA),REF(LL,1));//上上次MACD绿柱期间合约最小值
//MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(MACD,N2));//上次MACD绿柱期间MACD最小值
//MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));//上上次MACD绿柱期间MACD最小值
//B:=CROSS(DIFF,DEA)&&LL<LL2&&MLD>MLD2;//底背离
//DRAWICON(B,MACD,'ICO95');
//ZIG(MACD,100,1),COLORCYAN,LINETHICK3; //青色折线
J:=CROSS(DIFF,DEA);
S:=CROSS(DEA,DIFF);
//DIFF : EMA(CLOSE,12) - EMA(CLOSE,26);
//DEA : EMA(DIFF,9);
AT:=2*(DIFF-DEA),COLORSTICK;
MACDD:IF(AT>0,AT,DRAWNULL),COLORRED,NODRAW;
MACDD1:IF(AT<0,AT,DRAWNULL),COLORGREEN,NODRAW;
DRAWNUMBER(ISLASTBAR&&AT>0,AT,AT,2),COLORRED,ALIGN0,FONTSIZE15,VALIGN1;
DRAWNUMBER(ISLASTBAR&&AT<0,AT,AT,2),COLORGREEN,ALIGN0,FONTSIZE15,VALIGN1;
//DRAWCOLORLINE(MACD>REF(MACD,1),DIFF,COLORRED,COLORGREEN),LINETHICK4;
VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD>0),REF(VA1,1)+2),0.5);
P:=BACKSET(ISLASTBAR,SUMBARS(VA2,1));
VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);
VA4:=CROSS(BACKSET(CROSS(MACD,0) OR (ISLASTBAR AND MACD<0),REF(VA3,1)+2),0.5);
Q:=BACKSET(ISLASTBAR,SUMBARS(VA4,1));
AAX:=CROSS(BACKSET(REFX(J,1),LLVBARS(MACD,BARSLAST(S))+1),0.5),NODRAW;
BBX:=CROSS(BACKSET(REFX(S,1),HHVBARS(MACD,BARSLAST(J))+1),0.5),NODRAW;
//VERTLINE( AAX,COLORYELLOW),LINETHICK3;
//VERTLINE( BBX,COLORBLUE),LINETHICK3;
XX:=BACKSET(ISLASTBAR,BARSLAST(AAX||BBX)+1);
//DRAWGBK1(XX&&BARSLAST(AAX)<BARSLAST(BBX),COLORLIGHTRED);
//DRAWGBK1(XX&&BARSLAST(AAX)>BARSLAST(BBX),COLORLIGHTGREEN);
//DRAWGBK1(P,RGB(48,111,43));
//DRAWGBK1(Q,RGB(128,0,64));
VERTLINE(CROSS(Q,0.5),COLORMAGENTA),DASH;//紫色垂直虚线
VERTLINE(CROSS(P,0.5),COLORBLUE),DASH;//蓝色垂直虚线
//DRAWGBK1(P&&Q&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),RGB(48,111,43));
//DRAWGBK1(Q&&P&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),RGB(128,0,64));
DRAWSL(ISLASTBAR&&BARSLAST(P)<BARSLAST(Q),VALUEWHEN(VA2,MACD),0,BARSLAST(P)+1,1),COLORWHITE,LINETHICK3;
DRAWSL(ISLASTBAR&&BARSLAST(P)>BARSLAST(Q),VALUEWHEN(VA4,MACD),0,BARSLAST(Q)+1,1),COLORWHITE,LINETHICK3;
//DRAWNUMBER(P&&(REFX(VA2,1)||ISLASTBAR)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),VALUEWHEN(VA2,MACD),2,COLORWHITE),FONTSIZE24,ALIGN2,VALIGN0;
//DRAWNUMBER(Q&&(REFX(VA4,1)||ISLASTBAR)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),VALUEWHEN(VA4,MACD),2,COLORBLUE),FONTSIZE24,VALIGN2,ALIGN2;
//DRAWNUMBER(P&&NOT(Q)&&REFX(Q,1),VALUEWHEN(VA2,MACD),VALUEWHEN(VA2,MACD),2,COLORWHITE),FONTSIZE24,ALIGN2,VALIGN0;
//DRAWNUMBER(Q&&NOT(P)&&REFX(P,1),VALUEWHEN(VA4,MACD),VALUEWHEN(VA4,MACD),2,COLORBLUE),FONTSIZE24,VALIGN2,ALIGN2;
B11:=BACKSET(ISLASTBAR&&BARSLAST(P)<BARSLAST(Q),BARSLAST(P));
Y1:=BACKSET(ISLASTBAR&&BARSLAST(P)>BARSLAST(Q),BARSLAST(Q));
YY:=AAX||B11&&REF(NOT(B11),1);
BB:=BBX||Y1&&REF(NOT(Y1),1);
XX1:=BACKSET(ISLASTBAR,SUMBARS(YY||BB,2));
//VERTLINE(XX1&&AAX,COLORMAGENTA),DASH;//紫色垂直虚线(对应K线图虚线)
//VERTLINE(XX1&&BBX,COLORBLUE),DASH;//蓝色垂直虚线(对应K线图虚线)
VERTLINE(XX1&&B11&&REF(NOT(B11),1),COLORBLUE),DASH;//蓝色垂直虚线
VERTLINE(XX1&&Y1&&REF(NOT(Y1),1),COLORMAGENTA),DASH;//紫色垂直虚线
TT:=BACKSET(ISLASTBAR,MAX(SUMBARS(VA2,1),SUMBARS(VA4,1)));
//DRAWNUMBER(TT&&VA2,MACD,MACD,2,COLORWHITE),FONTSIZE30,ALIGN2,VALIGN1;
//DRAWNUMBER(TT&&VA4,MACD,MACD,2,COLORYELLOW),FONTSIZE30,ALIGN2,VALIGN1;
//DRAWTEXT(CROSS(P,0.5)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
DRAWTEXT(CROSS(Q,0.5)&&BARSLAST(P)<BARSLAST(Q),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORRED,FONTSIZE30;
DRAWTEXT(CROSS(P,0.5)&&BARSLAST(P)>BARSLAST(Q),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORGREEN,FONTSIZE20;
//DRAWTEXT(CROSS(Q,0.5)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
DRAWTEXT(BARSLAST(P)<BARSLAST(Q)&&CROSS(P,0.5),VALUEWHEN(VA2,MACD),'●'),VALIGN1,COLORGREEN,FONTSIZE30;
DRAWTEXT(BARSLAST(P)>BARSLAST(Q)&&CROSS(Q,0.5),VALUEWHEN(VA4,MACD),'●'),VALIGN1,COLORYELLOW,FONTSIZE20;
FROMOPEN:=IF(HOUR<12,60*(HOUR-9)-30+MINUTE,120+60*(HOUR-13)+MINUTE);
VAR1:=(2*CLOSE+HIGH+LOW)/40;
VAR2:=EMA(EMA(EMA(VAR1,4),4),4);
J1:(VAR2-REF(VAR2,1))/REF(VAR2,1)*100, COLORSTICK;
D:=MA(J1,3);
K:=MA(J1,1);
PW1:=EMA(((VOL*(CLOSE-OPEN)*240/FROMOPEN)/(CLOSE+OPEN)),38);
ME:=EMA(PW1,8)*0.1,COLORSTICK;
MEE:=ABS(J1);
V10:=PEAKBARS(C,15,1,0)<10;
V12:=IF(V10=1,50,0);
头部:=IF(V12=50,100,0);
TOB:=J1<=REF(J1,1) OR K<=D;
卖:=IF(头部>REF(头部,1),MEE,0),COLORGREEN,LINETHICK3;
V9:=TROUGHBARS(C,15,1,0)<10;
V11:=IF(V9=1,50,0);
底部:=IF(V11=50,50,0);
买底:=IF(底部>REF(底部,1),MEE,0),COLORRED,LINETHICK2;
STICKLINE(买底,0,MEE*0.9,1,0),COLORRED;
STICKLINE(卖,0,MEE*0.9,1,0),COLORBLUE;
STICKLINE(卖,0,MEE*0.9,0.6,0),COLORWHITE;
DRAWTEXT(底部>REF(底部,1),MACD,'底买'),COLORYELLOW,FONTSIZE15,VALIGN0;
DRAWTEXT(头部>REF(头部,1),MACD,'顶卖'),COLORWHITE,FONTSIZE15,VALIGN2;
//DRAWTEXT(头部>REF(头部,1),MEE*1.04,'▲'),COLORMAGENTA;
//DRAWTEXT(头部>REF(头部,1),MEE*1.08,'▲'),COLORLIGHTGREEN; 谢谢老师,咋没有蓝折线
来源 程序化久久网
有思路,想编写各种指标公式,交易模型,选股公式,还原公式的朋友
可联系技术人员 QQ: 262069696 或微信号:cxh99cxh99 进行 有偿收费 编写!
(注:由于人数限制,QQ或微信请选择方便的一个联系我们就行,加好友时请简单备注下您的需求,否则无法通过。谢谢您!)
相关文章
-
没有相关内容