通达信缠论买卖点副图指标 源码

[复制链接]
查看29 | 回复0 | 2022-7-11 10:38:54 | 显示全部楼层 |阅读模式
本帖是根据几位前辈的指标合成而成,自用方便,在此对几位前辈深表感谢!
参数设定:0=关,1=关;
布林 0 1 1
均线 0 1 1
三K线 0 1 1
峰谷 0 1 1
趋势 0 1 1
支压 0 1 1
参数设定上可对(布林,均线,三K线,峰谷,趋势,支压)分别开关,方便视图.
图中加入(MACD,KDJ,RSI)顶底背离仅供参考


X_1:=IF(布林,1,DRAWNULL);
布林中轨:MA(CLOSE,20)*X_1,DOTLINE,COLORWHITE;
布林上轨:(布林中轨+2*STD(CLOSE,20))*X_1,DOTLINE,COLORYELLOW;
布林下轨:(布林中轨-2*STD(CLOSE,20))*X_1,DOTLINE,COLORMAGENTA;
DRAWBAND(布林中轨,RGB(99,0,50),布林上轨,RGB(99,0,50));
DRAWBAND(布林中轨,RGB(0,50,99),布林下轨,RGB(0,50,99));
DRAWBAND(布林中轨,RGB(99,0,50),布林上轨,RGB(99,0,50));
DRAWBAND(布林中轨,RGB(0,50,99),布林下轨,RGB(0,50,99));
X_2:=IF(均线,1,DRAWNULL);
MA5:MA(CLOSE,5)*X_2,COLORWHITE;
MA10:MA(CLOSE,10)*X_2,COLORBLUE;
X_3:=IF(三K线,1,DRAWNULL);
X_4:=MAX(MAX(REFX(LOW,1),REFX(LOW,2)),REFX(LOW,3));
X_5:=MIN(MIN(REFX(HIGH,1),REFX(HIGH,2)),REFX(HIGH,3));
X_6:=(X_4+X_5)/2;
X_7:=X_6>REFX(LOW,3) AND REFX(LOW,2)<X_6 AND REFX(LOW,1)<X_6;
X_8:=FILTER(X_7,BARSLAST(X_7)+2);
X_9:=X_7 AND X_8;
X_10:=IF(REF(X_9,1),HIGH,0);
STICKLINE(X_3=1 AND REF(X_9,2),REF(X_5,2),REF(X_4,2),13,(-1)),COLORWHITE;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
X_11:=IF(峰谷,1,DRAWNULL);
X_12:=10;
X_13:=REF(HIGH,X_12)=HHV(HIGH,2*X_12+1);
X_14:=FILTER(X_13,X_12);
X_15:=BACKSET(X_14,X_12+1);
X_16:=FILTER(X_15,X_12);
峰线:REF(HIGH,BARSLAST(X_16))*X_11,POINTDOT,COLORRED,LINETHICK4;
X_17:=REF(LOW,X_12)=LLV(LOW,2*X_12+1);
X_18:=FILTER(X_17,X_12);
X_19:=BACKSET(X_18,X_12+1);
X_20:=FILTER(X_19,X_12);
谷线:REF(LOW,BARSLAST(X_20))*X_11,POINTDOT,COLORGREEN,LINETHICK4;
X_21:=IF(趋势,1,DRAWNULL);
X_22:=BACKSET(ISLASTBAR,BARSLAST(X_16)+1);
X_23:=X_22>REF(X_22,1);
压力轨:DRAWLINE(X_16,HIGH,X_23,HIGH,1)*X_21,COLORRED;
X_24:=BACKSET(ISLASTBAR,BARSLAST(X_20)+1);
X_25:=X_24>REF(X_24,1);
支撑轨:DRAWLINE(X_20,LOW,X_25,LOW,1)*X_21,COLORGREEN;
中轨:(压力轨+支撑轨)/2*X_21,COLORWHITE;
X_26:=IF(支压,1,DRAWNULL);
X_27:=5;
X_28:=10;
X_29:=REF(HIGH,X_27)=HHV(HIGH,2*X_27+1);
X_30:=FILTER(X_29,X_27);
X_31:=BACKSET(X_30,X_27+1);
X_32:=FILTER(X_31,X_27);
X_33:=BACKSET(ISLASTBAR,BARSLAST(X_32)+1);
X_34:=X_33>REF(X_33,1);
短压:DRAWLINE(X_32,HIGH,X_34,HIGH,1)*X_26,COLORLIRED;
短压线:DRAWICON(X_34,HIGH*1,2)*X_26;
X_35:=REF(LOW,X_27)=LLV(LOW,2*X_27+1);
X_36:=FILTER(X_35,X_27);
X_37:=BACKSET(X_36,X_27+1);
X_38:=FILTER(X_37,X_27);
X_39:=BACKSET(ISLASTBAR,BARSLAST(X_38)+1);
X_40:=X_39>REF(X_39,1);
短支:DRAWLINE(X_38,LOW,X_40,LOW,1)*X_26,COLORLIGREEN;
短支线:DRAWICON(X_40,LOW*1,1)*X_26;
X_41:=4;
X_42:=HIGH=HHV(HIGH,X_41*5) AND HHV(HIGH,X_41*5)>REF(HHV(HIGH,X_41*5),1);
X_43:=LOW=LLV(LOW,X_41*5) AND LLV(LOW,X_41*5)<REF(LLV(LOW,X_41*5),1);
CCA:DRAWLINE(X_42,HIGH,X_43,LOW,0),COLORYELLOW,LINETHICK2;
CCB:DRAWLINE(X_43,LOW,X_42,HIGH,0),COLORMAGENTA,LINETHICK2;
0;
1;
X_44:=1;
X_45:=BACKSET(LLV(LOW,5)<REF(LLV(LOW,4),1),4);
X_46:=BACKSET(X_45=0 AND REF(X_45,1)=1,2);
X_47:=IF(X_46=1 AND REF(X_46,1)=0,(-1),0);
X_48:=BACKSET(HHV(HIGH,5)>REF(HHV(HIGH,4),1),4);
X_49:=BACKSET(X_48=0 AND REF(X_48,1)=1,2);
X_50:=IF(X_49=1 AND REF(X_49,1)=0,1,0);
X_51:=IF(LOW>REF(HIGH,1),1,IF(HIGH<REF(LOW,1),(-1),0));
X_52:=BARSLAST(X_50=1);
X_53:=BARSLAST(X_47=(-1));
X_54:=LOWRANGE(LOW);
X_55:=TOPRANGE(HIGH);
X_56:=IF(X_47=(-1) AND REF(X_52,1)>REF(X_53,1) AND LLV(LOW,X_52+1)<REF(LLV(LOW,X_52+1),1),(-1),0);
X_57:=IF(X_47=(-1) AND REF(X_52,1)<=REF(X_53,1) AND (X_52>=4 OR LLV(X_51,X_52)=(-1) OR LLV(LOW,X_53+2)<REF(LLV(LOW,X_53+1),1)),(-1),0);
X_58:=IF(X_56=(-1) OR X_57=(-1) AND LOW<REF(HIGH,X_52+1),(-1),0);
X_59:=IF(X_53<4 AND HHV(X_51,X_53)!=1 OR REF(X_58,X_53)=0,1,0);
X_60:=IF(X_50=1 AND REF(X_53,1)<=REF(X_52,1) AND X_59=1 AND X_55>REF(X_54,X_53+1) AND X_55>REF(X_54,X_53) AND X_55>REF(X_55,X_52),1,0);
X_61:=IF(X_50=1 AND REF(X_53,1)>REF(X_52,1) AND HHV(HIGH,X_53+1)>REF(HHV(HIGH,X_53+1),1),1,0);
X_62:=IF(X_50=1 AND REF(X_53,1)<=REF(X_52,1) AND REF(X_58,X_53)=(-1) AND (X_53>=4 OR HHV(X_51,X_53)=1),1,0);
X_63:=IF(X_61=1 OR X_62=1 OR X_60=1 AND HIGH>REF(LOW,X_53+1),1,0);
X_64:=IF(X_52<4 AND HHV(X_51,X_52)!=1 OR REF(X_63,X_52)=0,1,0);
X_65:=IF(X_47=(-1) AND REF(X_52,1)<=REF(X_53,1) AND X_64=1 AND X_54>REF(X_55,X_52+1) AND X_54>REF(X_55,X_52) AND X_54>REF(X_54,X_53),(-1),0);
X_66:=IF(X_47=(-1) AND REF(X_52,1)>REF(X_53,1) AND LLV(LOW,X_52+1)<REF(LLV(LOW,X_52+1),1),(-1),0);
X_67:=IF(X_47=(-1) AND REF(X_52,1)<=REF(X_53,1) AND (X_52>=4 OR LLV(X_51,X_52)=(-1) OR X_65=(-1)),(-1),0);
X_68:=IF(X_66=(-1) OR X_67=(-1) AND LOW<REF(HIGH,X_52+1),(-1),0);
X_69:=BARSLAST(X_63=1);
X_70:=BARSLAST(X_68=(-1));
X_71:=IF(X_70<4 AND HHV(X_51,X_70)!=1 OR REF(X_68,X_70)=0,1,0);
X_72:=IF(X_50=1 AND REF(X_70,1)<=REF(X_69,1) AND X_71=1 AND X_55>REF(X_54,X_70+1) AND X_55>REF(X_54,X_70) AND X_55>REF(X_55,X_69),1,0);
X_73:=IF(X_50=1 AND REF(X_70,1)>REF(X_69,1) AND HHV(HIGH,X_70+1)>REF(HHV(HIGH,X_70+1),1),1,0);
X_74:=IF(X_50=1 AND REF(X_70,1)<=REF(X_69,1) AND REF(X_68,X_70)=(-1) AND (X_70>=4 OR HHV(X_51,X_70)=1),1,0);
X_75:=IF(X_73=1 OR X_74=1 OR X_72=1 AND HIGH>REF(LOW,X_70+1),1,0);
X_76:=IF(X_69<4 AND HHV(X_51,X_69)!=1 OR REF(X_73,X_69)=0,1,0);
X_77:=IF(X_47=(-1) AND REF(X_69,1)<=REF(X_70,1) AND X_76=1 AND X_54>REF(X_55,X_69+1) AND X_54>REF(X_55,X_69) AND X_54>REF(X_54,X_70),(-1),0);
X_78:=IF(X_47=(-1) AND REF(X_69,1)>REF(X_70,1) AND LLV(LOW,X_69+1)<REF(LLV(LOW,X_69+1),1),(-1),0);
X_79:=IF(X_47=(-1) AND REF(X_69,1)<=REF(X_70,1) AND (X_69>=4 OR LLV(X_51,X_69)=(-1) OR X_77=(-1)),(-1),0);
X_80:=IF(X_78=(-1) OR X_79=(-1) AND LOW<REF(HIGH,X_69+1),(-1),0);
X_81:=BARSLAST(X_75=1);
X_82:=BARSLAST(X_80=(-1));
X_83:=IF(X_82<4 AND HHV(X_51,X_82)!=1 OR REF(X_80,X_82)=0,1,0);
X_84:=IF(X_50=1 AND REF(X_82,1)<=REF(X_81,1) AND X_83=1 AND X_55>REF(X_54,X_82+1) AND X_55>REF(X_54,X_82) AND X_55>REF(X_55,X_81),1,0);
X_85:=IF(X_50=1 AND REF(X_82,1)>REF(X_81,1) AND HHV(HIGH,X_82+1)>REF(HHV(HIGH,X_82+1),1),1,0);
X_86:=IF(X_50=1 AND REF(X_82,1)<=REF(X_81,1) AND REF(X_80,X_82)=(-1) AND (X_82>=4 OR HHV(X_51,X_82)=1),1,0);
X_87:=IF(X_85=1 OR X_86=1 OR X_84=1 AND HIGH>REF(LOW,X_82+1),1,0);
X_88:=IF(X_81<4 AND HHV(X_51,X_81)!=1 OR REF(X_85,X_81)=0,1,0);
X_89:=IF(X_47=(-1) AND REF(X_81,1)<=REF(X_82,1) AND X_88=1 AND X_54>REF(X_55,X_81+1) AND X_54>REF(X_55,X_81) AND X_54>REF(X_54,X_82),(-1),0);
X_90:=IF(X_47=(-1) AND REF(X_81,1)>REF(X_82,1) AND LLV(LOW,X_81+1)<REF(LLV(LOW,X_81+1),1),(-1),0);
X_91:=IF(X_47=(-1) AND REF(X_81,1)<=REF(X_82,1) AND (X_81>=4 OR LLV(X_51,X_81)=(-1) OR X_89=(-1)),(-1),0);
X_92:=IF(X_90=(-1) OR X_91=(-1) AND LOW<REF(HIGH,X_81+1),(-1),0);
X_93:=IF(X_87=1 AND X_92=(-1) AND HIGH>REF(HIGH,REF(X_81,1)+2),1,IF(X_87=1 AND X_92=(-1) AND LOW<REF(LOW,REF(X_82,1)+2),(-1),0));
X_94:=IF(X_93=0,X_87+X_92,X_93);
X_95:=IF(X_94=(-1),LOW,IF(X_94=1,HIGH,DRAWNULL));
C1:DRAWLINE(X_94=(-1),X_95,X_94=1,X_95,0),DOTLINE,COLORMAGENTA;
C2:DRAWLINE(X_94=1,X_95,X_94=(-1),X_95,0),DOTLINE,COLORYELLOW;
DRAWTEXT(X_94=1,X_95,3),COLORGREEN;
DRAWTEXT(X_94=(-1),X_95,4),COLORRED;
X_96:=REF(CLOSE,1);
X_97:=SMA(MAX(CLOSE-X_96,0),3,1)/SMA(ABS(CLOSE-X_96),3,1)*100;
X_98:=EMA(CLOSE,3);
X_99:=EMA(CLOSE,21);
DRAWTEXT(CROSS(X_98,X_99),LOW*0.999,5),COLORRED;
X_100:=SMA(MAX(CLOSE-REF(CLOSE,1),0),3,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),3,1)*100;
DRAWTEXT(CROSS(88,X_100) AND MA(CLOSE,3)>EMA(CLOSE,3),HIGH*1.001,6),COLORGREEN;
DRAWTEXT(REF(CLOSE,BARSLAST(REF(CROSS(MACD.DIF,MACD.DEA),1))+1)>CLOSE AND REF(MACD.DIF,BARSLAST(REF(CROSS(MACD.DIF,MACD.DEA),1))+1)<MACD.DIF AND CROSS(MACD.DIF,MACD.DEA)>0,LOW-0.002,7),COLORRED;
DRAWTEXT(REF(CLOSE,BARSLAST(REF(CROSS(KDJ.K,KDJ.D),1))+1)>CLOSE AND REF(KDJ.K,BARSLAST(REF(CROSS(KDJ.K,KDJ.D),1))+1)<KDJ.K AND CROSS(KDJ.K,KDJ.D),LOW-0.003,8),COLORBLUE;
DRAWTEXT(REF(CLOSE,BARSLAST(REF(CROSS(RSI.RSI1,RSI.RSI2),1))+1)>CLOSE AND REF(RSI.RSI1,BARSLAST(REF(CROSS(RSI.RSI1,RSI.RSI2),1))+1)<RSI.RSI1 AND CROSS(RSI.RSI1,RSI.RSI2)>0,LOW-0.004,9);
DRAWTEXT(REF(CLOSE,BARSLAST(REF(CROSS(MACD.DEA,MACD.DIF),1))+1)<CLOSE AND REF(MACD.DIF,BARSLAST(REF(CROSS(MACD.DEA,MACD.DIF),1))+1)>MACD.DIF AND CROSS(MACD.DEA,MACD.DIF)>0,HIGH+0.002,10),COLORGREEN;
DRAWTEXT(REF(CLOSE,BARSLAST(REF(CROSS(KDJ.D,KDJ.K),1))+1)<CLOSE AND REF(KDJ.K,BARSLAST(REF(CROSS(KDJ.D,KDJ.K),1))+1)>KDJ.K AND CROSS(KDJ.D,KDJ.K)>0,HIGH+0.003,11);


20193210165224225.jpg

20193210165224225.jpg

20193210173333569.rar

32.79 KB, 下载次数: 1

售价: 1 金钱  [记录]

20193210173333569.rar

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则