如何在macd显示2个以上峰值和谷值

    无敌期货 发表于 2020-06-20 20:32 ・1020次浏览 3条跟帖 赢顺 wh6 回复

    在电脑版或手机版的软件上 显示方框或鼠标划定框框中 能不能显示MACD的峰值或谷值(2-3个最高点和2-3个最低点) 类似指数的最高点和最低点(多个)    
    我找到类似的 但是我想保留macd其他正常显示(红柱绿柱 DEA线等 )取消黄色柱、笑哭脸、提示声音 谢谢
    
    DIFF :EMA(CLOSE,4) - EMA(CLOSE,8);//短周期与长周期的收盘价的指数平滑移动平均值做差。
    DEA :=EMA(DIFF,4);//DIFF的M个周期指数平滑移动平均
    MACD:2*(DIFF-DEA),COLORSTICK;//DIFF减DEA的2倍画柱状线
    
    J:=CROSS(DIFF,DEA);
    S:=CROSSDOWN(DIFF,DEA);
    
    N1:=BARSLAST(J)+1;
    N2:=BARSLAST(S)+1;
    
    P:=BACKSET(J,LLVBARS(MACD, N2)+1);
    Q:=BACKSET(S,HHVBARS(MACD, N1)+1);
    K:=BACKSET(ISLASTBAR,HHVBARS(ABS(MACD),MIN(N1, N2))+1);
    
    STICKLINE(CROSS(P,0.5),MACD,0,COLORYELLOW,0);
    STICKLINE(CROSS(Q,0.5),MACD,0,COLORYELLOW,0);
    STICKLINE(CROSS(K,0.5),MACD,0,COLORYELLOW,0);
    
    CROSS(MACD,0),SOUND('A');
    CROSSDOWN(MACD,0),SOUND('B');
    
    MHD:VALUEWHEN(CROSSDOWN(DIFF,DEA),HHV(DIFF,N1)),NODRAW;//上次MACD红柱期间DIFF最大值
    MLD:VALUEWHEN(CROSS(DIFF,DEA),LLV(DIFF,N2)),NODRAW;
    
    A:=BACKSET(S||MACD>0&&ISLASTBAR,HHVBARS(DIFF,N1)+1);
    B:=BACKSET(J||MACD<0&&ISLASTBAR,LLVBARS(DIFF,N2)+1);
    
    DRAWICON(CROSS(A,0.5),DIFF,1),VALIGN2;
    DRAWICON(CROSS(B,0.5),DIFF,2),VALIGN0;
    DRAWNUMBER(CROSS(A,0.5),DIFF,DIFF,2,COLORYELLOW),VALIGN0;
    DRAWNUMBER(CROSS(B,0.5),DIFF,DIFF,2,COLORYELLOW);
    

    文华财经 沙发

    DEA画线参考:
    DIFF :EMA(CLOSE,4) - EMA(CLOSE,8);//短周期与长周期的收盘价的指数平滑移动平均值做差。
    DEA : EMA(DIFF,4);//DIFF的M个周期指数平滑移动平均
    MACD:2*(DIFF-DEA),COLORSTICK;//DIFF减DEA的2倍画柱状线
    
    J:=CROSS(DIFF,DEA);
    S:=CROSSDOWN(DIFF,DEA);
    
    N1:=BARSLAST(J)+1;
    N2:=BARSLAST(S)+1;
    
    P:=BACKSET(J,LLVBARS(MACD, N2)+1);
    Q:=BACKSET(S,HHVBARS(MACD, N1)+1);
    K:=BACKSET(ISLASTBAR,HHVBARS(ABS(MACD),MIN(N1, N2))+1);
    
    MHD:VALUEWHEN(CROSSDOWN(DIFF,DEA),HHV(DIFF,N1)),NODRAW;//上次MACD红柱期间DIFF最大值
    MLD:VALUEWHEN(CROSS(DIFF,DEA),LLV(DIFF,N2)),NODRAW;
    
    A:=BACKSET(S||MACD>0&&ISLASTBAR,HHVBARS(DIFF,N1)+1);
    B:=BACKSET(J||MACD<0&&ISLASTBAR,LLVBARS(DIFF,N2)+1);
    
    DRAWNUMBER(CROSS(A,0.5),DIFF,DIFF,2,COLORYELLOW),VALIGN0;
    DRAWNUMBER(CROSS(B,0.5),DIFF,DIFF,2,COLORYELLOW);
    
    回复

    autojiaoyi.com 板凳

    KDJ也可以标注,如下
    RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
    K:SMA(RSV,3,1);
    D:SMA(K,3,1);
    JJ:3*K-2*D;
    
    J:=CROSS(K,D);
    S:=CROSSDOWN(K,D);
    
    N1:=BARSLAST(J)+1;
    N2:=BARSLAST(S)+1;
    
    P:=BACKSET(J,LLVBARS(K, N2)+1);
    Q:=BACKSET(S,HHVBARS(K, N1)+1);
    
    KK:=BACKSET(ISLASTBAR,HHVBARS(ABS(K),MIN(N1, N2))+1);
    MHD:VALUEWHEN(S,HHV(KK,N1)),NODRAW;//上次K红柱期间DIFF最大值
    MLD:VALUEWHEN(J,LLV(KK,N2)),NODRAW;
    
    A:=BACKSET(S||K>D&&ISLASTBAR,HHVBARS(K,N1)+1);
    B:=BACKSET(J||K<D&&ISLASTBAR,LLVBARS(K,N2)+1);
    
    DRAWNUMBER(CROSS(A,0.5),K,K,2,COLORYELLOW),VALIGN0;
    DRAWNUMBER(CROSS(B,0.5),K,K,2,COLORYELLOW);
    
    回复

    autojiaoyi.com 地板

    RSI,如下:
    LC := REF(CLOSE,1);
    
    RSI1:SMA(MAX(CLOSE-LC,0),7,1)/SMA(ABS(CLOSE-LC),7,1)*100;
    RSI2:SMA(MAX(CLOSE-LC,0),14,1)/SMA(ABS(CLOSE-LC),14,1)*100;
    
    J:=CROSS(RSI1,RSI2);
    S:=CROSSDOWN(RSI1,RSI2);
    
    N1:=BARSLAST(J)+1;
    N2:=BARSLAST(S)+1;
    
    P:=BACKSET(J,LLVBARS(RSI1, N2)+1);
    Q:=BACKSET(S,HHVBARS(RSI1, N1)+1);
    K:=BACKSET(ISLASTBAR,HHVBARS(ABS(RSI1),MIN(N1, N2))+1);
    
    MHD:VALUEWHEN(S,HHV(RSI1,N1)),NODRAW;//上次RSI1红柱期间RSI1最大值
    MLD:VALUEWHEN(J,LLV(RSI1,N2)),NODRAW;
    
    A:=BACKSET(S||RSI1>RSI2&&ISLASTBAR,HHVBARS(RSI1,N1)+1);
    B:=BACKSET(J||RSI1<RSI2&&ISLASTBAR,LLVBARS(RSI1,N2)+1);
    
    DRAWNUMBER(CROSS(A,0.5),RSI1,RSI1,2,COLORYELLOW),VALIGN0;
    DRAWNUMBER(CROSS(B,0.5),RSI1,RSI1,2,COLORYELLOW);
    回复

    本版积分规则

    发布新内容
    请关注微信公众号,获取最新指标公式
    加入收藏 我要分享
    分享到论坛或者博客

    复制
    热门指标策略
    快速回复 返回顶部 返回列表