斐波那契MACD通达信公式 副图 源码附图
QXG:=BARSCOUNT(V)>100;
QSTT:=IF(NAMELIKE('ST') OR NAMELIKE('*ST'),0,1);
QKC:=IF(CODELIKE('688'),0,1);
AA1G:=REF(LOW,1);
AA2G:=SMA(ABS(LOW-AA1G),13,1)/SMA(MAX(LOW-AA1G,0),13,1)*100;
AA3:=EMA(IF(CLOSE*1.2,AA2G*13,AA2G/13),13);
AA4:=LLV(LOW,34);
AA5:=HHV(AA3,34);
AA6:=IF(LLV(LOW,56),1,0);
AA7C:=EMA(IF(LOW<=AA4,(AA3+AA5*2)/2,0),3)/618*AA6;
AA8C:=AA7C>REF(AA7C,1);
AA9:=REF(LLV(LOW,100),3);
AA10:=REFDATE(AA9,DATE);
AA11:=LOW=AA10;
AA12:=AA8C AND AA11;
AA13:=AA12>REF(AA12,1);
起动:(AA13>REF(AA13,1) AND QSTT)/5,COLORRED;
DIF:(EMA(CLOSE,12)-EMA(CLOSE,26)),COLORWHITE;
DEA:(EMA(DIF,9)),COLORYELLOW;
IF(DIF>DEA,DIF,DRAWNULL),COLORRED,LINETHICK2;
IF(DEA<DIF,DEA,DRAWNULL),COLORMAGENTA,LINETHICK2;
DRAWICON(CROSS(DEA,DIF),DEA,2);
MACD:(DIF-DEA)*2,COLORSTICK,COLORGREEN;
{股票指标网 }
MACD2:=MACD;
MJ:=MACD;
S05:=SUM(MJ,0);
QST:=BARSLAST(MJ<0 AND REF(MJ,1)>0)+1;
QXT:=BARSLAST(MJ>0 AND REF(MJ,1)<0)+1;
S5:=IF(MJ>0,S05-REF(S05,BARSLAST(MJ<0)),S05-REF(S05,BARSLAST(MJ>0)))/10;
ST:=IF(MJ>0,REF(QST,QXT)+QXT,REF(QXT,QST)+QST);
RS5:=REF(S5,ST);
WWWFXJGSWCOM:=REF(S5,ST);
BC:IF(MJ>0 AND S5<RS5,0,IF(MJ<0 AND S5>RS5 AND DEA<0,0.02,0)),COLORYELLOW,VOLSTICK;
获利比:WINNER(C),NODRAW;
STICKLINE((MACD2>=0),0,MACD2,0,1),COLORRED;
STICKLINE(((MACD2>=0) AND (MACD2 < REF(MACD2,1))),0,MACD2,0,0),COLORMAGENTA;
STICKLINE((MACD2<0),0,MACD2,0,0),COLORGREEN;
STICKLINE(((MACD2<0) AND (MACD2 > REF(MACD2,1))),0,MACD2,0,1),COLORWHITE;
DRAWICON(LONGCROSS(CLOSE,MA(CLOSE,5),17),MACD2,1);
DRAWICON(LONGCROSS(MA(CLOSE,5),CLOSE,17),MACD2,2);
DRAWICON(CROSS(DIF,DEA),LLV(DIF,1),29);
DRAWICON(CROSS(DIF>=0,DIF<DEA),DIF,1);
低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
DRAWICON(二次金叉,0,25);
三次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=3,60)=1;
DRAWICON(三次金叉,0,26);A1:=IF(MACD2>0,1,-1);
TJ:=MACD2>0;
T:=MACD2<0;
A:=LLV(MACD2,50)=MACD2;
DRAWICON(A AND FILTERX(A,20), MACD2,1);
DRAWTEXT(BARSLAST(TJ)=1,MACD2,'1'),COLORGREEN;
DRAWTEXT(BARSLAST(TJ)=2,MACD2,'2'),COLORGREEN;
DRAWTEXT(BARSLAST(TJ)=3,MACD2,'3'),COLORGREEN;
DRAWTEXT(BARSLAST(TJ)=5,MACD2,'5'),COLORGREEN;
DRAWTEXT(BARSLAST(TJ)=8,MACD2,'8'),COLORGREEN;
DRAWTEXT(BARSLAST(TJ)=13,MACD2,'13'),COLORGREEN;
DRAWTEXT(BARSLAST(TJ)=21,MACD2,'21'),COLORGREEN;
DRAWTEXT(BARSLAST(TJ)=34,MACD2,'34'),COLORGREEN;
DRAWTEXT(BARSLAST(TJ)=55,MACD2,'55'),COLORGREEN;
DRAWTEXT(BARSLAST(T)=1,MACD2,'1'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=2,MACD2,'2'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=3,MACD2,'3'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=5,MACD2,'5'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=8,MACD2,'8'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=13,MACD2,'13'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=21,MACD2,'21'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=34,MACD2,'34'),COLORYELLOW;
DRAWTEXT(BARSLAST(T)=55,MACD2,'55'),COLORYELLOW;
未来函数检测结果如下:
该公式包含未来函数:WINNER
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
QXG赋值:V的有效数据周期数>100
QSTT赋值:IF(NAMELIKE('ST') OR NAMELIKE('*ST'),0,1)
QKC赋值:IF(CODELIKE('688'),0,1)
AA1G赋值:1日前的最低价
AA2G赋值:SMA(最低价-AA1G的绝对值,13,1)/SMA(最低价-AA1G和0较大值,13,1)*100
如果收盘价*1.2返回AA2G*13否则返回AA2G/13
AA4赋值:34日内最低价最低值
AA5赋值:34日内AA3最高值
AA6赋值:IF(56日内最低价最低值,1,0)
AA7C赋值:EMA(IF(最低价<=AA4,(AA3+AA5*2)/2,0),3)/618*AA6
AA8C赋值:AA7C>1日前的AA7C
AA9赋值:REF(100日内最低价最低值,3)
AA10赋值:REFDATE(AA9,DATE)
AA11赋值:最低价=AA10
AA12赋值:AA8C AND AA11
AA13赋值:AA12>1日前的AA12
输出起动:(AA13>1日前的AA13 AND QSTT)/5,画红色
输出DIF:(收盘价的12日指数移动平均-收盘价的26日指数移动平均),COLORWHITE
输出DEA:(DIF的9日指数移动平均),画黄色
如果D>DEA返回DIF否则返回DRAWNULL
如果DEA
DRAWICON(DEA上穿DIF,DEA,2)
输出MACD:(DIF-DEA)*2,COLORSTICK,画绿色
{股票指标网 }
MACD2:=MACD
MJ赋值:MACD
S05赋值:0的MJ日累和
QST赋值:上次MJ<0 AND 1日前的MJ>0距今天数+1
QXT赋值:上次MJ>0 AND 1日前的MJ<0距今天数+1
S5赋值:IF(MJ>0,S05-REF(S05,上次MJ<0距今天数),S05-REF(S05,BARSLAST(MJ>0)))/10
ST赋值:IF(MJ>0,QXT日前的QST+QXT,QST日前的QXT+QST)
RS5赋值:ST日前的S5
WWWFXJGSWCOM赋值:ST日前的S5
输出BC:IF(MJ>0 AND S5RS5 AND DEA<0,0.02,0)),画黄色,成交量STICK
输出获利比:C计算的获利盘比例,NODRAW
STICKLINE((MACD2>=0),0,MACD2,0,1),画红色
STICKLINE(((MACD2>=0) AND (MACD2 < 1日前的MACD2)),0,MACD2,0,0),COLORMAGENTA
STICKLINE((MACD2<0),0,MACD2,0,0),画绿色
STICKLINE(((MACD2<0) AND (MACD2 > 1日前的MACD2)),0,MACD2,0,1),COLORWHITE
DRAWICON(LONGCROSS(收盘价,收盘价的5日简单移动平均,17),MACD2,1)
DRAWICON(LONGCROSS(收盘价的5日简单移动平均,收盘价,17),MACD2,2)
DRAWICON(DIF上穿DEA,1日内DIF最低值,29)
DRAWICON(DIF>=0上穿DIF
低位金叉赋值:DIF上穿DEA AND DIF<-0.1
JCCOUNT赋值:COUNT(DIF上穿DEA,上次DEA>=0距今天数)
二次金叉赋值:DIF上穿DEA AND DEA<0 AND 统计21日满足JC=2的天数=1
当满足条件二次金叉时,在0和25之间画图标
三次金叉赋值:DIF上穿DEA AND DEA<0 AND 统计60日满足JC=3的天数=1
当满足条件三次金叉时,在0和26之间画图标
如果MACD2>0返回1否则返回-1
TJ赋值:MACD2>0
T赋值:MACD2<0
A赋值:50日内MACD2最低值=MACD2
DRAWICON(A AND FILTERX(A,20), MACD2,1)
DRAWTEXT(上次TJ距今天数=1,MACD2,'1'),画绿色
DRAWTEXT(上次TJ距今天数=2,MACD2,'2'),画绿色
DRAWTEXT(上次TJ距今天数=3,MACD2,'3'),画绿色
DRAWTEXT(上次TJ距今天数=5,MACD2,'5'),画绿色
DRAWTEXT(上次TJ距今天数=8,MACD2,'8'),画绿色
DRAWTEXT(上次TJ距今天数=13,MACD2,'13'),画绿色
DRAWTEXT(上次TJ距今天数=21,MACD2,'21'),画绿色
DRAWTEXT(上次TJ距今天数=34,MACD2,'34'),画绿色
DRAWTEXT(上次TJ距今天数=55,MACD2,'55'),画绿色
DRAWTEXT(上次T距今天数=1,MACD2,'1'),画黄色
DRAWTEXT(上次T距今天数=2,MACD2,'2'),画黄色
DRAWTEXT(上次T距今天数=3,MACD2,'3'),画黄色
DRAWTEXT(上次T距今天数=5,MACD2,'5'),画黄色
DRAWTEXT(上次T距今天数=8,MACD2,'8'),画黄色
DRAWTEXT(上次T距今天数=13,MACD2,'13'),画黄色
DRAWTEXT(上次T距今天数=21,MACD2,'21'),画黄色
DRAWTEXT(上次T距今天数=34,MACD2,'34'),画黄色
DRAWTEXT(上次T距今天数=55,MACD2,'55'),画黄色