四色谱指数平,黄色来判断趋势(通达信公式 主图 源码 测试图)
{四色谱指数平}DRAWGBK(C>0, RGB(00,00,00),RGB(54,0,0),0,'11',0);Z1:=STRCAT(HYBLOCK,'----'); Z2:=STRCAT(Z1,FGBLOCK);Z3:=STRCAT(Z2,DYBLOCK); Z4:=STRCAT(Z3,'----'); DRAWTEXT_FIX(1,0.00,0.06,0,CLOSE)COLORCYAN;MA1:=EMA(C,8);MA2:=EMA(C,48);MA3:=EMA(C,34);MA4:=EMA(C,7);MA5:=EMA(C,20);MA6:=EMA(C,10);DIFF:=EMA(CLOSE,5)-EMA(CLOSE,13);DEA:=EMA(DIFF,9);{生命线}N1:=BARSLAST(CROSS(DIFF,DEA))+1;{最近一次满足条件DIFF上穿DEA的K线到当前的距离}N2:=BARSLAST(CROSS(DEA,DIFF))+1;{最近一次满足条件DIFF下穿DEA的K线到当前的距离}{当前是DIFF>DEA的状态,连结最近两个DIFF>DEA区间(不包含当前区间)内最高点的趋势线}A1:=BACKSET(ISLASTBAR && N1<N2,REF(REF(HHVBARS(H,N1)+1,N2),N2)+REF(N2,N2)+N2);B1:=BACKSET(ISLASTBAR && N1<N2,REF(HHVBARS(H,N1),N2)+N2+1);{当前是DIFF>DEA的状态,连结最近两个DIFF<DEA区间内最低点的趋势线}A2:=BACKSET(ISLASTBAR && N1<N2,REF(REF(LLVBARS(L,N2)+1,N1),N2)+REF(N1,N2)+N2);B2:=BACKSET(ISLASTBAR && N1<N2,REF(LLVBARS(L,N2)+1,N1)+N1);{当前是DIFF<DEA的状态,连结最近两个DIFF<DEA区间(不包含当前区间)内最低点的趋势线}A3:=BACKSET(ISLASTBAR && N1>N2,REF(REF(LLVBARS(L,N2)+1,N1),N1)+REF(N1,N1)+N1);B3:=BACKSET(ISLASTBAR && N1>N2,REF(LLVBARS(L,N2),N1)+N1+1);{当前是DIFF<DEA的状态,连结最近两个DIFF>DEA区间内最高点的趋势线}A4:=BACKSET(ISLASTBAR && N1>N2,REF(REF(HHVBARS(H,N1)+1,N2),N1)+REF(N2,N1)+N1);B4:=BACKSET(ISLASTBAR && N1>N2,REF(HHVBARS(H,N1)+1,N2)+N2);力