今日推送指标公式(压力支撑主图) 文 | 沉默仓鼠哥
压力支撑主图 这是一个操盘辅助指标公式,图形直观易懂,买卖点位清楚;每个位置的细节支撑位和压力位。通过在不同压力位和支撑位之间画出一条线,我们判断市场的趋势。分别支撑线、强势、突破线可以持仓,警示、压力线注意高抛风险。
如果市场价格在突破位上方运行,说明市场处于上升趋势;如果市场价格在强势线下方运行,说明市场处于下降趋势;如果在压力位和支撑位之间震荡,说明市场处于横盘整理阶段。
但是有未来函数,有出现高位钝化或者低位钝化的情况。下图是运用指标公式{压力支撑主图}选股示例:
主图指标源代码:
{神奇九转} N:=CURRBARSCOUNT; B:=C<REF(C,4); JT1:= BARSLASTCOUNT(B); A_B1:=(JT1>9) AND MOD(JT1,9)=1; A_B2:=(JT1>9) AND MOD(JT1,9)=2; A_B8:=(JT1>9) AND MOD(JT1,9)=8; A_B9:=(JT1>9) AND MOD(JT1,9)=0; B1:=(N=6 AND REFXV(COUNT(B,6),5)=6) OR (N=7 AND REFXV(COUNT(B,7),6)=7) OR (N=8 AND REFXV(COUNT(B,8),7)=8) OR (N>=9 AND REFXV(COUNT(B,9),8)=9); DRAWNUMBER(B1 AND (REF(B,1)=0 OR A_B1),L,1),COLORMAGENTA; B2:=(N=5 AND REFXV(COUNT(B,6),4)=6) OR (N=6 AND REFXV(COUNT(B,7),5)=7) OR (N=7 AND REFXV(COUNT(B,8),6)=8) OR (N>=8 AND REFXV(COUNT(B,9),7)=9); DRAWNUMBER(B2 AND(REF(B,2)=0 OR A_B2),L,2),COLORMAGENTA; B8:=(N=1 AND COUNT(B,8)=8) OR (N>=2 AND REFXV(COUNT(B,9),1)=9); DRAWNUMBER(B8 AND (REF(B,8)=0 OR A_B8),L,8),COLORMAGENTA; B9:=(N>=1 AND COUNT(B,9)=9); DRAWNUMBER(B9 AND (REF(B,9)=0 OR A_B9),L,9),COLORBROWN; S:=C>REF(C,4); JT2:= BARSLASTCOUNT(S); A_S1:=(JT2>9) AND MOD(JT2,9)=1; A_S2:=(JT2>9) AND MOD(JT2,9)=2; A_S8:=(JT2>9) AND MOD(JT2,9)=8; A_S9:=(JT2>9) AND MOD(JT2,9)=0; S1:=(N=6 AND REFXV(COUNT(S,6),5)=6) OR (N=7 AND REFXV(COUNT(S,7),6)=7) OR (N=8 AND REFXV(COUNT(S,8),7)=8) OR (N>=9 AND REFXV(COUNT(S,9),8)=9); DRAWNUMBER(S1 AND (REF(S,1)=0 OR A_S1),H,1),COLORMAGENTA,DRAWABOVE; S2:=(N=5 AND REFXV(COUNT(S,6),4)=6) OR (N=6 AND REFXV(COUNT(S,7),5)=7) OR (N=7 AND REFXV(COUNT(S,8),6)=8) OR (N>=8 AND REFXV(COUNT(S,9),7)=9); DRAWNUMBER(S2 AND (REF(S,2)=0 OR A_S2),H,2),COLORMAGENTA,DRAWABOVE; S8:=(N=1 AND COUNT(S,8)=8) OR (N>=2 AND REFXV(COUNT(S,9),1)=9); DRAWNUMBER(S8 AND (REF(S,8)=0 OR A_S8),H,8),COLORMAGENTA,DRAWABOVE; S9:=(N>=1 AND COUNT(S,9)=9); DRAWNUMBER(S9 AND (REF(S,9)=0 OR A_S9),H,9),COLORGREEN,DRAWABOVE;
{佛系} N1:=10;N2:=10;DISP:=2; K:=IF(PERIOD=5,1,{日} IF(PERIOD=6,1,{周} IF(PERIOD=7,1,{月} IF(PERIOD=8,1,{多分钟} IF(PERIOD=9,1,{多日} IF(PERIOD=10,1,{季} IF(PERIOD=11,2,{年} IF(PERIOD=4,1,{60F} IF(PERIOD=3,1,{30F} IF(PERIOD=2,1,{15F} IF(PERIOD=1,1{5F},1{1F})))))))))))/10; P1:=PEAK(1,K*N1,1); P2:=PEAK(1,K*N1,2); WP1:=PEAKBARS(1,K*N1,1); WP2:=PEAKBARS(1,K*N1,2); T1:=TROUGH(2,K*N2,1); T2:=TROUGH(2,K*N2,2); WT1:=TROUGHBARS(2,K*N2,1); WT2:=TROUGHBARS(2,K*N2,2); TJ1:=P1>T1 AND P2>T2 ; ZD:=MAX(T1,T2); ZG:=MIN(P1,P2); LL:=MIN(T1,T2); HH:=MAX(P1,P2); TJ2:=FILTER(ZG>ZD,2); TJ3:=ZG=REF(ZG,BARSLAST(TJ2)) OR ZD=REF(ZD,BARSLAST(TJ2)); TJ4:=TJ1&&TJ2&&NOT(TJ3); TJ5:=BETWEEN(ZD,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1))); TJ6:=BETWEEN(ZG,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1))); TJ7:=ZG>REF(ZG,REF(BARSLAST(TJ4),1))&&ZD<REF(ZD,REF(BARSLAST(TJ4),1)); TJ8:=TJ4&&NOT(TJ5 OR TJ6 OR TJ7); ZSD:=IF(TJ8,ZD,DRAWNULL); ZSG:=IF(TJ8,ZG,DRAWNULL); ZSH:=IF(TJ8,HH,DRAWNULL); ZSL:=IF(TJ8,LL,DRAWNULL); STICKLINE(TJ8,ZSH,ZSL,0,-1),COLORMAGENTA; STICKLINE(TJ8,ZSD,ZSG,IF(DISP=1,3,0),1),COLORMAGENTA; DRAWTEXT(DISP=2,ZSH,'中枢'),COLORWHITE; 中枢高LOYLINE(DISP=2,REF(ZSD,BARSLAST(TJ8))),CIRCLEDOT,COLORLIRED; 中枢低LOYLINE(DISP=2,REF(ZSG,BARSLAST(TJ8))),CIRCLEDOT,COLORLIGREEN;
趋势高LOYLINE(DISP=3,ZIG(1,K*N1)),COLORLIBLUE; 趋势低LOYLINE(DISP=3,ZIG(2,K*N2)),COLORLIBLUE; 局部低点预选A:=BACKSET(LLV(L,5)<REF(LLV(L,4),1),4); 局部低点预选B:=BACKSET(局部低点预选A=0 AND REF(局部低点预选A,1)=1,2); 局部低点预选C:=IF(局部低点预选B=1 AND REF(局部低点预选B,1)=0,-1,0); 局部高点预选A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4); 局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2); 局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选B,1)=0,1,0); 缺口判断:=IF(L>REF(H,1),1,IF(H<REF(L,1),-1,0)); 距前高天:=BARSLAST(局部高点预选C=1); 距前低天:=BARSLAST(局部低点预选C=-1); 小值周期:=LOWRANGE(L); 大值周期:=TOPRANGE(H); 低保留AA:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0); 低保留AB:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR LLV(L,距前低天+2)<REF(LLV(L,距前低天+1),1)),-1,0); 低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) AND L<REF(H,距前高天+1),-1,0); 预判:=IF((距前低天<4 AND HHV(缺口判断,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0); 判断:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND 预判=1 AND 大值周期>REF(小值周期,距前低天+1) AND 大值周期>REF(小值周期,距前低天) AND 大值周期>REF(大值周期,距前高天),1,0); 高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1)>REF(距前高天,1) AND HHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0); 高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天>=4 OR HHV(缺口判断,距前低天)=1),1,0); 高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) AND H>REF(L,距前低天+1),1,0); 预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0); 判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND 预判A=1 AND 小值周期>REF(大值周期,距前高天+1) AND 小值周期>REF(大值周期,距前高天) AND 小值周期>REF(小值周期,距前低天),-1,0); 低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0); 低保留B:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR 判断A=-1),-1,0); 低保留:=IF((低保留A=-1 OR 低保留B=-1) AND L<REF(H,距前高天+1),-1,0); 距前高天A:=BARSLAST(高保留=1); 距前低天A:=BARSLAST(低保留=-1); 预判X:=IF((距前低天A<4 AND HHV(缺口判断,距前低天A)!=1) OR REF(低保留,距前低天A)=0,1,0); 判断X:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND 预判X=1 AND 大值周期>REF(小值周期,距前低天A+1) AND 大值周期>REF(小值周期,距前低天A) AND 大值周期>REF(大值周期,距前高天A),1,0); 高保留XA:=IF(局部高点预选C=1 AND REF(距前低天A,1)>REF(距前高天A,1) AND HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0); 高保留XB:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND REF(低保留,距前低天A)=-1 AND (距前低天A>=4 OR HHV(缺口判断,距前低天A)=1),1,0); 高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判断X=1) AND H>REF(L,距前低天A+1),1,0); 预判XA:=IF((距前高天A<4 AND HHV(缺口判断,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0); 判断XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND 预判XA=1 AND 小值周期>REF(大值周期,距前高天A+1) AND 小值周期>REF(大值周期,距前高天A) AND 小值周期>REF(小值周期,距前低天A),-1,0); 低保留XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)>REF(距前低天A,1) AND LLV(L,距前高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0); 低保留XB:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND (距前高天A>=4 OR LLV(缺口判断,距前高天A)=-1 OR 判断XA=-1),-1,0); 低保留X:=IF((低保留XA=-1 OR 低保留XB=-1) AND L<REF(H,距前高天A+1),-1,0); 距前高天YA:=BARSLAST(高保留X=1); 距前低天YA:=BARSLAST(低保留X=-1); 预判YX:=IF((距前低天YA<4 AND HHV(缺口判断,距前低天YA)!=1) OR REF(低保留X,距前低天YA)=0,1,0); 判断YX:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND 预判YX=1 AND 大值周期>REF(小值周期,距前低天YA+1) AND 大值周期>REF(小值周期,距前低天YA) AND 大值周期>REF(大值周期,距前高天YA),1,0); 高保留YXA:=IF(局部高点预选C=1 AND REF(距前低天YA,1)>REF(距前高天YA,1) AND HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0); 高保留YXB:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND REF(低保留X,距前低天YA)=-1 AND (距前低天YA>=4 OR HHV(缺口判断,距前低天YA)=1),1,0); 高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判断YX=1) AND H>REF(L,距前低天YA+1),1,0); 预判YXA:=IF((距前高天YA<4 AND HHV(缺口判断,距前高天YA)!=1) OR REF(高保留YXA,距前高天YA)=0,1,0); 判断YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND 预判YXA=1 AND 小值周期>REF(大值周期,距前高天YA+1) AND 小值周期>REF(大值周期,距前高天YA) AND 小值周期>REF(小值周期,距前低天YA),-1,0); 低保留YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)>REF(距前低天YA,1) AND LLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0); 低保留YXB:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND (距前高天YA>=4 OR LLV(缺口判断,距前高天YA)=-1 OR 判断YXA=-1),-1,0); 低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) AND L<REF(H,距前高天YA+1),-1,0); AAAD:=IF(高保留YX=1 AND 低保留YX=-1 AND H>REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1 AND L<REF(L,REF(距前低天YA,1)+2),-1,0)); 极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD); 局部极点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)) CIRCLEDOT COLORYELLOW; DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0)COLORRED; DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0)COLORGREEN; DD1:=BARSLAST(ABS(极点保留)!=1); DRAWTEXT(极点保留=1,局部极点,'卖'),COLORGREEN; DRAWTEXT(极点保留=-1,局部极点,'买'),COLORRED; {压力尺} NC:=120; KC:=BARSLAST(CURRBARSCOUNT=NC); GD:=CONST(IF(ISLASTBAR=1,HHV(H,KC),0));{高点} DD:=CONST(IF(ISLASTBAR=1,LLV(L,KC),0));{低点} KJ:=GD-DD; GD4:=IF(CURRBARSCOUNT<=NC/2,GD,DRAWNULL); 高区:IF(CURRBARSCOUNT<=NC,GD,DRAWNULL),COLORRED,LINETHICK1; 低区:IF(CURRBARSCOUNT<=NC,DD,DRAWNULL),COLOR00FF00,LINETHICK1; 平衡:=IF(CURRBARSCOUNT<=NC,DD+KJ/2,DRAWNULL),COLOR00FFFF,NODRAW; 低:IF(CURRBARSCOUNT<=NC/2,DD,DRAWNULL),COLORFFFF00; 高:IF(CURRBARSCOUNT<=NC/2,GD,DRAWNULL),COLOR00FFFF; 支撑:IF(CURRBARSCOUNT<=NC/2,DD+KJ*0.191,DRAWNULL),COLOR00FFFF; 强势: IF(CURRBARSCOUNT<=NC/2,DD+KJ*0.382,DRAWNULL),COLORFF00FF; 突破:IF(CURRBARSCOUNT<=NC/2,DD+KJ/2,DRAWNULL),COLOR0000FF; 警示:IF(CURRBARSCOUNT<=NC/2,DD+KJ*0.618,DRAWNULL),COLOR00FFFF; 压力:IF(CURRBARSCOUNT<=NC/2,DD+KJ*0.809,DRAWNULL),COLOR00FF00; 低涨:IF(CURRBARSCOUNT<=NC/2,(C/LLV(LOW,K)-1)*100,DRAWNULL),COLOR0000FF,NODRAW; 天数:BARSLAST(L=DD),COLORCYAN,NODRAW; 顶点:IF(CURRBARSCOUNT<=NC/2, CONST(IF(ISLASTBAR=1,HHV(H, BARSLAST(CURRBARSCOUNT=60)),1)),DRAWNULL),COLORRED,CROSSDOT; 低点:IF(CURRBARSCOUNT<=NC/2, CONST(IF(ISLASTBAR=1,LLV(L, BARSLAST(CURRBARSCOUNT=60)),1)),DRAWNULL),COLORMAGENTA,CROSSDOT; STICKLINE(CCI>=200 AND H>=顶点,O,C,2,0),COLORBLUE; STICKLINE(CCI<=100 AND L<=低点,O,C,2,0),COLORYELLOW; STICKLINE(CURRBARSCOUNT=NC,GD,DD,0,0),COLORGREEN; STICKLINE(CURRBARSCOUNT=NC/2,GD,DD,0,0),COLOR408080; STICKLINE(CURRBARSCOUNT=1,GD,DD,0,0),COLORGREEN; STICKLINE(CURRBARSCOUNT<=NC/2,支撑,支撑,2,0),COLORFF00FF; STICKLINE(CURRBARSCOUNT<=NC/2,强势,强势,2,0),COLORFF00FF; STICKLINE(CURRBARSCOUNT<=N/2,突破,突破,2,0),COLORABABAB; STICKLINE(CURRBARSCOUNT<=NC/2,警示,警示,2,0),COLOR00FFFF; STICKLINE(CURRBARSCOUNT<=NC/2,压力,压力,2,0),COLOR00FFFF; DRAWTEXT(CURRBARSCOUNT=50,压力,'压力'),COLOR00FFFF; DRAWTEXT(CURRBARSCOUNT=10,警示,'警示'),COLOR00FFFF; DRAWTEXT(CURRBARSCOUNT=10,突破,'突破'),COLORFFFFFF; DRAWTEXT(CURRBARSCOUNT=10,强势,'强势'),COLOR00FFFF; DRAWTEXT(CURRBARSCOUNT=10,支撑,'支撑'),COLOR00FFFF; DRAWTEXT(CURRBARSCOUNT=NC/4+5,GD-KJ*0.09,'【风险】--高抛避险'),COLOR00FFFF; DRAWTEXT(CURRBARSCOUNT=NC/4+5,GD-KJ*0.3,'【警示】--逢高减仓'),COLOR0000FF; DRAWTEXT(CURRBARSCOUNT=NC/4+5,GD-KJ*0.45,'【突破】--主力拉升'),COLORFFFFFF; DRAWTEXT(CURRBARSCOUNT=NC/4+5,GD-KJ*0.6,'【拉升】--强势畜锐'),COLORFFFF80; DRAWTEXT(CURRBARSCOUNT=NC/4+5,DD+KJ/4.8,'【关注】--逢低买入'),COLOR00FFFF; DRAWTEXT(CURRBARSCOUNT=NC/4+5,DD+KJ/32,'【低吸】--大胆买入'),COLOR00FF00; DRAWTEXT(CURRBARSCOUNT=NC/2+40,GD-KJ*0.25,'【拉升】'),COLORRED;
|