我修改的版本只能用于日线或以上, 希望有大神能帮忙修改
上图是我改的,下图是原来的 说明:DIF线红色是多头,紫色是空头,黄s是转变信号; {我修改的macd} {大机构MACD的柱线} MACD2:=2*("MACD.DIF"-"MACD.DEA"); (CLOSE<0 AND CROSS("MACD.DIF",0),H*1.3),COLOR000080,NODRAW; (CLOSE<0 AND CROSS(MACD2,0),H*1.3),COLOR000080,NODRAW; (CLOSE<0 AND CROSS(0,"MACD.DIF"),H*1.3),COLOR808080,NODRAW; (CLOSE<0 AND CROSS(0,MACD2),H*1.3),COLOR808080,NODRAW; DU0:=CROSS("MACD.DIF",0); UD0:=CROSS(0,"MACD.DIF"); TDU0:=BARSLAST(DU0); TUD0:=BARSLAST(UD0); DU3:=REF(DU0,1); UD3:=REF(UD0,1); TDU3:=BARSLAST(DU3); TUD3:=BARSLAST(UD3); UDGLINE:=IF(TDU3<TUD3,REF(HHV(HIGH,2),TDU3),REF(LLV(LOW,2),TUD3)); JDU0:=REF(CLOSE,1)<=REF(UDGLINE,1) AND CLOSE>UDGLINE AND TDU0<TUD0; JUD0:=REF(CLOSE,1)>=REF(UDGLINE,1) AND CLOSE<UDGLINE AND TUD0<TDU0; JDU1:=JDU0 AND COUNT(JDU0,TDU0)=1; JUD1:=JUD0 AND COUNT(JUD0,TUD0)=1; JDU2:=JDU1 AND REF(BARSLAST(JUD1),1)<REF(BARSLAST(JDU1),1); JUD2:=JUD1 AND REF(BARSLAST(JUD1),1)>REF(BARSLAST(JDU1),1); JDU3:=JDU1 AND REF(BARSLAST(JUD1),1)>REF(BARSLAST(JDU1),1); JUD3:=JUD1 AND REF(BARSLAST(JUD1),1)<REF(BARSLAST(JDU1),1); BSLINE:=IF(BARSLAST(JDU2)<BARSLAST(JUD2),IF(REF(CROSS(0,MACD2),1),LLV(LOW,2),REF(LLV(LOW,2),BARSLAST(REF(CROSS(0,MACD2),1)))),IF(REF(CROSS(MACD2,0),1),HHV(HIGH,2),REF(HHV(HIGH,2),BARSLAST(REF(CROSS(MACD2,0),1))))); STICKLINE(MACD2>=0,0,MACD2,2,1),COLORRED;{0上红空心MACD柱} STICKLINE(MACD2>=0 AND MACD2<REF(MACD2,1),0,MACD2,2,0),COLORLIRED;{0上粉红实心柱} STICKLINE(MACD2<0,0,MACD2,2,0),COLORCYAN;{0下亮蓝实心柱} STICKLINE(MACD2<0 AND MACD2>REF(MACD2,1),0,MACD2,2,1),COLORFF8000;{0下蓝空心MACD柱} {--------------图标} DEFUT:=BARSLAST(CROSS(MACD2,0)); DEFDT:=BARSLAST(CROSS(0,MACD2)); DEFUL:=IF(MACD2>=0,HHV(MACD2,DEFUT+1),REF(HHV(MACD2,DEFUT+1),DEFDT+1)); DEFDL:=IF(MACD2<0,LLV(MACD2,DEFDT+1),REF(LLV(MACD2,DEFDT+1),DEFUT+1)); DEFU2L:=REF(DEFUL,DEFUT+1); DEFD2L:=REF(DEFDL,DEFDT+1); DRAWICON(LLV(MACD2,4)>0 AND MACD2<REF(MACD2,1) AND REF(MACD2,1)>REF(MACD2,2) AND REF(MACD2,2)>REF(MACD2,3),MACD2,2); DRAWICON(HHV(MACD2,4)<0 AND MACD2>REF(MACD2,1) AND REF(MACD2,1)<REF(MACD2,2) AND REF(MACD2,2)<REF(MACD2,3),MACD2,1); DRAWICON((JUD1 OR BARSLAST(JDU1)>BARSLAST(JUD1)) AND MACD2>=0 AND REF(MACD2,1)<REF(DEFU2L,1) AND MACD2>DEFU2L,MACD2,5); DRAWICON((JDU1 OR BARSLAST(JDU1)<BARSLAST(JUD1)) AND MACD2<0 AND REF(MACD2,1)>REF(DEFD2L,1) AND MACD2<DEFD2L,MACD2,3); VAR111:=JDU1 OR BARSLAST(JDU1)<BARSLAST(JUD1); VAR112:=HHV(MACD2,4)<0 AND MACD2>REF(MACD2,1) AND REF(MACD2,1)<REF(MACD2,2) AND REF(MACD2,2)<REF(MACD2,3); {DIF和DEA线} SHORT:=12;LONG:=26;MID:=9; VA:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL); OBV1:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0); OBV2:=EMA(OBV1,3)-MA(OBV1,9); OBV3:=EMA(IF(OBV2>0,OBV2,0),3); MAC3:=MA(C,3); DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG)COLORYELLOW,LINETHICK2;{黄线} DEA:EMA(DIF,MID)COLORBLUE;{蓝线} DIF1:IF(DIF>REF(DIF,1),DIF,DRAWNULL),COLOR8000FF,LINETHICK2;{玫红线} DIF2:IF(DIF<REF(DIF,1),DIF,DRAWNULL),COLORFF0080,LINETHICK2;{紫线} {金叉和背离的标识} 低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1; DRAWTEXT(低位金叉,-0.5,'★低位金叉'),COLORWHITE; JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0)); 二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1; DRAWICON(二次金叉,DEA*0.9,1) ; DRAWTEXT(二次金叉,0.5,'★二次金叉'),COLORYELLOW; A1:=BARSLAST(REF(CROSS(DIF,DEA),1)); 底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA); DRAWTEXT(底背离,-1,'▲底背离'),COLORFF00FF; A2:=BARSLAST(REF(CROSS(DEA,DIF),1)); 顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF); DRAWTEXT(顶背离,1,'●顶背离'),COLORGREEN; DRAWTEXT(低位金叉 AND 二次金叉 AND 底背离,0,'★三项全能'),COLORYELLOW; -------------------------------------------------------------------------------------- {大机构macd} {参数:LONG 20 100 26 SHORT 5 40 12 M 2 60 9} DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26); DEA:=EMA(DIFF,9); MACD2:=2*(DIFF-DEA); (CLOSE<0 AND CROSS(DIFF,0),H*1.3),COLOR000080,NODRAW; (CLOSE<0 AND CROSS(MACD2,0),H*1.3),COLOR000080,NODRAW; (CLOSE<0 AND CROSS(0,DIFF),H*1.3),COLOR808080,NODRAW; (CLOSE<0 AND CROSS(0,MACD2),H*1.3),COLOR808080,NODRAW; DU0:=CROSS(DIFF,0); UD0:=CROSS(0,DIFF); TDU0:=BARSLAST(DU0); TUD0:=BARSLAST(UD0); DU3:=REF(DU0,1); UD3:=REF(UD0,1); TDU3:=BARSLAST(DU3); TUD3:=BARSLAST(UD3); UDGLINE:=IF(TDU3<TUD3,REF(HHV(HIGH,2),TDU3),REF(LLV(LOW,2),TUD3)); JDU0:=REF(CLOSE,1)<=REF(UDGLINE,1) AND CLOSE>UDGLINE AND TDU0<TUD0; JUD0:=REF(CLOSE,1)>=REF(UDGLINE,1) AND CLOSE<UDGLINE AND TUD0<TDU0; JDU1:=JDU0 AND COUNT(JDU0,TDU0)=1; JUD1:=JUD0 AND COUNT(JUD0,TUD0)=1; JDU2:=JDU1 AND REF(BARSLAST(JUD1),1)<REF(BARSLAST(JDU1),1); JUD2:=JUD1 AND REF(BARSLAST(JUD1),1)>REF(BARSLAST(JDU1),1); JDU3:=JDU1 AND REF(BARSLAST(JUD1),1)>REF(BARSLAST(JDU1),1); JUD3:=JUD1 AND REF(BARSLAST(JUD1),1)<REF(BARSLAST(JDU1),1); BSLINE:=IF(BARSLAST(JDU2)<BARSLAST(JUD2),IF(REF(CROSS(0,MACD2),1),LLV(LOW,2),REF(LLV(LOW,2),BARSLAST(REF(CROSS(0,MACD2),1)))),IF(REF(CROSS(MACD2,0),1),HHV(HIGH,2),REF(HHV(HIGH,2),BARSLAST(REF(CROSS(MACD2,0),1))))); STICKLINE(MACD2>=0,0,MACD2,2,1),COLOR0000FF; STICKLINE(MACD2>=0 AND MACD2<REF(MACD2,1),0,MACD2,2,0),COLOR0000FF; STICKLINE(MACD2<0,0,MACD2,2,0),COLORFFFF00; STICKLINE(MACD2<0 AND MACD2>REF(MACD2,1),0,MACD2,2,1),COLORFFFF00; DIF:DIFF,LINETHICK2,COLOR0000FF; MACD:DEA,COLORFF0000; DEF:MACD2,LINETHICK0,COLORFFFF00; STICKLINE(CLOSE>0,0,0,2,0),COLOR808080; DEFUT:=BARSLAST(CROSS(MACD2,0)); DEFDT:=BARSLAST(CROSS(0,MACD2)); DEFUL:=IF(MACD2>=0,HHV(MACD2,DEFUT+1),REF(HHV(MACD2,DEFUT+1),DEFDT+1)); DEFDL:=IF(MACD2<0,LLV(MACD2,DEFDT+1),REF(LLV(MACD2,DEFDT+1),DEFUT+1)); DEFU2L:=REF(DEFUL,DEFUT+1); DEFD2L:=REF(DEFDL,DEFDT+1); DRAWICON(LLV(MACD2,4)>0 AND MACD2<REF(MACD2,1) AND REF(MACD2,1)>REF(MACD2,2) AND REF(MACD2,2)>REF(MACD2,3),MACD2,2); DRAWICON(HHV(MACD2,4)<0 AND MACD2>REF(MACD2,1) AND REF(MACD2,1)<REF(MACD2,2) AND REF(MACD2,2)<REF(MACD2,3),MACD2,1); DRAWICON((JUD1 OR BARSLAST(JDU1)>BARSLAST(JUD1)) AND MACD2>=0 AND REF(MACD2,1)<REF(DEFU2L,1) AND MACD2>DEFU2L,MACD2,5); DRAWICON((JDU1 OR BARSLAST(JDU1)<BARSLAST(JUD1)) AND MACD2<0 AND REF(MACD2,1)>REF(DEFD2L,1) AND MACD2<DEFD2L,MACD2,3); VAR111:=JDU1 OR BARSLAST(JDU1)<BARSLAST(JUD1); VAR112:=HHV(MACD2,4)<0 AND MACD2>REF(MACD2,1) AND REF(MACD2,1)<REF(MACD2,2) AND REF(MACD2,2)<REF(MACD2,3); |
评论内容只代表网友观点,与本站立场无关!
本网提供的公式文件说明:
* alg格式飞狐股票公式,可以用飞狐交易师或者交易师软件导入;
* fnc格式大智慧新一代公式指标,可以用大智慧股票软件使用,少部分可以用分析家股票软件引入使用;
* exp格式大智慧经典版股票公式,仅可以用大智慧经典版股票软件引入使用;
* tni和tnc格式通达信股票公式,仅可以用通达信新引入使用,例如可以用通达信股票软件引入使用;
* tne,tn6格式通达信公式,可以用通达信公式编辑器5.0版导入,推荐通达信金融终端版本;
* hxf格式同花顺股票公式,仅可以用同花顺股票软件引入使用。
以上的各种软件都可以在本网股票软件栏目找到!
* 关于股票公式时间限制,如果在引入大智慧公式,交易师公式或者飞狐公式的时候,发现公式名称栏是空白的,这时候调整电脑时间到1997年,又能出现公式名称,并且能正常显示,可能是公式使用期限已过。
* 关于还原公式源码如果你忘记了自己编写的大智慧公式,通达信公式,同花顺公式,操盘手公式,飞狐公式,博易大师公式,金字塔公式,文华公式和交易师公式等等公式的密码,本网可帮恢复源码,有.偿.服.务无意勿扰,点击在线咨询联系我。
* 关于股票公式源码编辑
本网提供的源码,一般都可以编辑成公式,如果不明白公式的编辑,在本页右侧教程录像可参考,或者找公式教程资料学习,请搜索:教程
* 如果您发现软件内容或者链接错误,请点击报告错误谢谢!
* 站内提供的所有软件包含源码均是由网上搜集,若侵犯了你的版权利益,请联系通知我们!