至尊变色MACD,顶底背离自动划线部分有未来函数,这个已经是公知了。
公式指标用法:
为了方便看盘,我更喜欢界面简洁的指标,因此MACD柱子只设计了3种色调,红色:强势;白色:转弱;绿色:转强。底背离自动划蓝线,顶背离自动紫线。水下二次金叉划红色小箭头,低位金叉0轴上第1柱画黄柱。MACD死叉后算出红柱面积写红色数字,MACD金叉后算出绿色柱体面积写绿色数字。面积数字更方便判读顶底背离。
,COLORBLUE,LINETHICK2;A2:=BARSLAST(REF(CROSS(DEA1,DIF1),1));顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF1,A2+1)>DIF1 AND CROSS(DEA1,DIF1);顶背
RAWLINE(A2=0,DEA1,顶背离,DEA1,0),COLORFF00FF,LINETHICK2; {周期放大开关:1为普通模式,0为放大模式}周期放大:=1;数显开关:=1;倍数:=IF(PERIOD=11,1,{年}IF(PERIOD=10,4,{季}IF(PERIOD=9,6, {多日}IF(PERIOD=8,10,{多分钟}IF(PERIOD=7,12,{月}IF(PERIOD=6,5, {周}IF(PERIOD=5,5, {日}IF(PERIOD=4,4, {60F}IF(PERIOD=3,8, {30F}IF(PERIOD=2,4, {15F}IF(PERIOD=1,6, {5F}IF(PERIOD=0,5, {1F}1))))))))))));N1:=IF(周期放大,12,12*倍数);N2:=IF(周期放大,26,26*倍数);N3:=IF(周期放大,9,9*倍数);DIFF:EMA(CLOSE,N1) - EMA(CLOSE,N2),COLORWHITE,NODRAW;红柱面积:IF(MACD>0,SUM(MACD,BARSLAST(MACD<0)),0),NODRAW,COLORRED;绿柱面积:ABS(IF(MACD<0,SUM(MACD,BARSLAST(MACD>0)),0)),NODRAW,COLORLIGREEN;MACD面积:=IF(MACD>0,红柱面积,绿柱面积),NODRAW,COLORFFFF00;位置:=MAX(HHV(DIFF,100),ABS(LLV(DIFF,100)));{数显开关:1为打开,0为关闭}WWW70822COM:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));DRAWNUMBER(数显开关=1 AND LONGCROSS(DEA,DIFF,3),位置*0.8,REF(红柱面积,1)),COLORRED;DRAWNUMBER(数显开关=1 AND LONGCROSS(DIFF,DEA,3),0-位置*0.5,REF(绿柱面积,1)),COLORGREEN;NOTEXTLMH: DRAWNUMBER(数显开关=1 AND ISLASTBAR AND MACD>0,位置*0.8,红柱面积),COLORRED;NOTEXTLML: DRAWNUMBER(数显开关=1 AND ISLASTBAR AND MACD<0,0-位置*0.5,绿柱面积),COLORGREEN;