通达信公式神级MACD底背
N1:=9;
N2:=5;
N3:=13;
XIAO1:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);
XIAO2:=SMA(ABS(LOW-XIAO1),13,1)/SMA(MAX(LOW-XIAO1,0),10,1);
XIAO3:=EMA(XIAO2,10);
XIAO4:=LLV(LOW,33);
XIAO5:=EMA(IF(LOW<=XIAO4,XIAO3,0),3);
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,3,0 ),COLOR000055;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,2.6,0 ),COLOR000077;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,2.1,0 ),COLOR000099;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,1.5,0 ),COLOR0000BB;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,0.9,0 ),COLOR0000DD;
STICKLINE(XIAO5>REF(XIAO5,1),0,XIAO5,0.3,0 ),COLOR0000FF;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,3,0),COLOR005500;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,2.6,0),COLOR007700;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,2.1,0),COLOR009900;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,1.5,0),COLOR00BB00;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,0.9,0),COLOR00DD00;
STICKLINE(XIAO5<REF(XIAO5,1),0,XIAO5,0.3,0),COLOR00FF00;
【私暮进场】:IF(XIAO5>REF(XIAO5,1),XIAO5,0),COLORRED,NODRAW;
【私暮洗盘】:IF(XIAO5<REF(XIAO5,1),XIAO5,0),COLORGREEN,NODRAW;
B1:=(HHV(H,9)-C)/(HHV(H,9)-LLV(LOW,9))*100- 70;
B2:=SMA(B1,9,1)+100;
B3:=(C-LLV(L,9))/(HHV(H,9)- LLV(L,9))*100;
B4:=SMA(B3,3,1);
B5:=SMA(B4,3,1)+100;
B6:=B5-B2;
观望期:=IF(B6>60,B6-60,0);
T1:=STICKLINE(REF(观望期,1)<观望期,观望期,REF(观望期,1),9,0),COLORYELLOW;
T2:=STICKLINE(REF(观望期,1)>观望期,观望期,REF(观望期,1),9,0),COLORCYAN;{趋势背景}
TAI1:=MA(C,1)/MA(REF(C,13),8)*100;
TAI2:=MA(FORCAST(TAI1,21),3);
{}
TAI3:=REF(TAI1,1);
TAI4:=REF(TAI1,2);
邰1:=LLV(LOW,8);
邰2:=HHV(HIGH,13);
#股市黑客#:= EMA((CLOSE-邰1)/(邰2-邰1)*100,5),COLORRED,LINETHICK3;{输出后是趋势背景}
※升跌临界※:= EMA(0.667*REF(#股市黑客#,1)+0.333*#股市黑客#,2),COLORGREEN,LINETHICK3;{输出后是趋势背景}
VAR1:=(CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2));
VARD:=(CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2));
VARE:=(REF(VARD,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VARF:=(REF(VARE,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR10:=(REF(VARF,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR11:=(REF(VAR10,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR12:=(REF(VAR11,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR13:=(REF(VAR12,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR14:=(REF(VAR13,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR15:=(REF(VAR14,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR16:=(REF(VAR15,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR17:=(REF(VAR16,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2));
VAR18:=(REF(VAR17,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2));
VAR19:=REF(VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18,1) AND VAR1;
DIFF:=EMA(DCLOSE,12)-EMA(DCLOSE,26);{来自经典副B}
DEA:=EMA(DIFF,9),COLORFFFF00;
MACD:=(DIFF-DEA)*2;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
¥①:IF(REF((MA(C,5)-C)/C>0.04 AND (MA(C,10)-MA(C,5))/MA(C,5)>0.04 AND 观望期=0 AND C>REF(C,1),1),44,0),LINETHICK3,COLORCYAN;{进}
¥②:IF(REF("KDJ.J",1)<0 AND "KDJ.J">0 AND TAI1>=TAI2 AND TAI3>TAI4,34,0),LINETHICK3,COLOR0000FF;{进}
¥③:IF(REF(#股市黑客#,1)<=13&&CROSS(#股市黑客#,※升跌临界※)&&REF(MA(C,55),1)>REF(MA(C,55),2)&&(VAR19 OR REF(VAR19,1)),23,0),COLORBLUE,LINETHICK3;
¥④:IF(底背离,57,0),LINETHICK3,COLORBROWN;
DRAWTEXT(底背离,54,'←MACD底背离'),COLORWHITE;
DRAWICON(REF(#股市黑客#,1)<=13&&CROSS(#股市黑客#,※升跌临界※)&&REF(MA(C,55),1)>REF(MA(C,55),2)&&(VAR19 OR REF(VAR19,1)),25,5);
DRAWICON(REF((MA(C,5)-C)/C>0.04 AND (MA(C,10)-MA(C,5))/MA(C,5)>0.04 AND 观望期=0 AND C>REF(C,1),1),46,5);
DRAWICON(REF("KDJ.J",1)<0 AND "KDJ.J">0 AND TAI1>=TAI2 AND TAI3>TAI4,36,5),COLORYELLOW;
未来函数检测结果如下:
该公式包含未来函数:DCLOSE
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
N1赋值:9
N2赋值:5
N3赋值:13
XIAO1赋值:REF((最低价+开盘价+收盘价+最高价)/4,1)
XIAO2赋值:SMA(最低价-XIAO1的绝对值,13,1)/SMA(最低价-XIAO1和0较大值,10,1)
XIAO3赋值:XIAO2的10日指数移动平均
XIAO4赋值:33日内最低价最低值
如果最低价<=XIAO4返回XIAO3否则返回0
STICKLINE(XIAO5>1日前的XIAO5,0,XIAO5,3,0 ),COLOR000055
STICKLINE(XIAO5>1日前的XIAO5,0,XIAO5,2.6,0 ),COLOR000077
STICKLINE(XIAO5>1日前的XIAO5,0,XIAO5,2.1,0 ),COLOR000099
STICKLINE(XIAO5>1日前的XIAO5,0,XIAO5,1.5,0 ),COLOR0000BB
STICKLINE(XIAO5>1日前的XIAO5,0,XIAO5,0.9,0 ),COLOR0000DD
STICKLINE(XIAO5>1日前的XIAO5,0,XIAO5,0.3,0 ),COLOR0000FF
STICKLINE(XIAO5<1日前的XIAO5,0,XIAO5,3,0),COLOR005500
STICKLINE(XIAO5<1日前的XIAO5,0,XIAO5,2.6,0),COLOR007700
STICKLINE(XIAO5<1日前的XIAO5,0,XIAO5,2.1,0),COLOR009900
STICKLINE(XIAO5<1日前的XIAO5,0,XIAO5,1.5,0),COLOR00BB00
STICKLINE(XIAO5<1日前的XIAO5,0,XIAO5,0.9,0),COLOR00DD00
STICKLINE(XIAO5<1日前的XIAO5,0,XIAO5,0.3,0),COLOR00FF00
输出
【私暮进场】:IF(XIAO5>1日前的XIAO5,XIAO5,0),画红色,NODRAW
输出
【私暮洗盘】:IF(XIAO5<1日前的XIAO5,XIAO5,0),画绿色,NODRAW
B1赋值:(9日内H最高值-C)/(9日内H最高值-9日内最低价最低值)*100- 70
B1的9日[1日权重]移动平均
B3赋值:(C-9日内L最低值)/(9日内H最高值- 9日内L最低值)*100
B3的3日[1日权重]移动平均
B4的3日[1日权重]移动平均
B6赋值:B5-B2
如果B6>60返回B6-60否则返回0
T1赋值:STICKLINE(1日前的观望期<观望期,观望期,1日前的观望期,9,0),画黄色
T2赋值:STICKLINE(1日前的观望期>观望期,观望期,1日前的观望期,9,0),画青色
{趋势背景}
TAI1赋值:C的1日简单移动平均/13日前的C的8日简单移动平均*100
TAI2赋值:MA(FORCAST(TAI1,21),3)
{}
TAI3赋值:1日前的TAI1
TAI4赋值:2日前的TAI1
邰1赋值:8日内最低价最低值
邰2赋值:13日内最高价最高值
#股市黑客#赋值: EMA((收盘价-邰1)/(邰2-邰1)*100,5),画红色, 线宽为3
{输出后是趋势背景}
※升跌临界※赋值: E0.667*1日前的#股市黑客#+0.333*#股市黑客#的2日简单移动平均,画绿色, 线宽为3
{输出后是趋势背景}
VAR1赋值:(收盘价>1日前的收盘价 AND 收盘价>2日前的收盘价)
VARD赋值:(收盘价<1日前的收盘价 AND 收盘价<2日前的收盘价)
VARE赋值:(1日前的VARD AND 收盘价>=1日前的收盘价 AND 收盘价<=2日前的收盘价)
VARF赋值:(1日前的VARE AND 收盘价<=1日前的收盘价 AND 收盘价>=2日前的收盘价)
VAR10赋值:(1日前的VARF AND 收盘价>=1日前的收盘价 AND 收盘价<=2日前的收盘价)
VAR11赋值:(1日前的VAR10 AND 收盘价<=1日前的收盘价 AND 收盘价>=2日前的收盘价)
VAR12赋值:(1日前的VAR11 AND 收盘价>=1日前的收盘价 AND 收盘价<=2日前的收盘价)
VAR13赋值:(1日前的VAR12 AND 收盘价<=1日前的收盘价 AND 收盘价>=2日前的收盘价)
VAR14赋值:(1日前的VAR13 AND 收盘价>=1日前的收盘价 AND 收盘价<=2日前的收盘价)
VAR15赋值:(1日前的VAR14 AND 收盘价<=1日前的收盘价 AND 收盘价>=2日前的收盘价)
VAR16赋值:(1日前的VAR15 AND 收盘价>=1日前的收盘价 AND 收盘价<=2日前的收盘价)
VAR17赋值:(1日前的VAR16 AND 收盘价<=1日前的收盘价 AND 收盘价>=2日前的收盘价)
VAR18赋值:(1日前的VAR17 AND 收盘价>=1日前的收盘价 AND 收盘价<=2日前的收盘价)
VAR19赋值:1日前的VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18 AND VAR1
DIFF赋值:D收盘价的12日指数移动平均-D收盘价的26日指数移动平均
{来自经典副B}
DEA赋值:DIFF的9日指数移动平均,COLORFFFF00
MACD赋值:(DIFF-DEA)*2
A1赋值:上次1日前的DIFF上穿DEA距今天数
A2赋值:上次1日前的DEA上穿DIFF距今天数
底背离赋值:A1+1日前的收盘价>收盘价 AND DIFF>A1+1日前的DIFF AND DIFF上穿DEA
顶背离赋值:A2+1日前的收盘价<收盘价 AND A2+1日前的DIFF>DIFF AND DEA上穿DIFF
输出
¥①:IF(REF((C的5日简单移动平均-C)/C>0.04 AND (C的10日简单移动平均-C的5日简单移动平均)/C的5日简单移动平均>0.04 AND 观望期=0 AND C>REF(C,1),1),44,0), 线宽为3,画青色
输出{进}
¥②:IF(1日前的"KDJ.J"<0 AND "KDJ.J">0 AND TAI1>=TAI2 AND TAI3>TAI4,34,0), 线宽为3,COLOR0000FF
输出{进}
¥③:IF(1日前的#股市黑客#<=13&&#股市黑客#上穿※升跌临界※&&REF(C的55日简单移动平均,1)>REF(C的55日简单移动平均,2)&&(VAR19 OR REF(VAR19,1)),23,0), 画蓝色, 线宽为3
如果底背离返回57否则返回0
当满足条件底背离时,在54和'←MACD底背离'位置书写文字
DRAWICON(1日前的#股市黑客#<=13&&#股市黑客#上穿※升跌临界※&&REF(C的55日简单移动平均,1)>REF(C的55日简单移动平均,2)&&(VAR19 OR REF(VAR19,1)),25,5)
DRAWICON(REF((C的5日简单移动平均-C)/C>0.04 AND (C的10日简单移动平均-C的5日简单移动平均)/C的5日简单移动平均>0.04 AND 观望期=0 AND C>REF(C,1),1),46,5)
DRAWICON(1日前的"KDJ.J"<0 AND "KDJ.J">0 AND TAI1>=TAI2 AND TAI3>TAI4,36,5),画黄色