通达信K线自定义主图指标 源码

[复制链接]
查看86 | 回复0 | 2021-8-26 22:10:12 | 显示全部楼层 |阅读模式

以下是通达信K线自定义主图指标 源码(无源码的请下载附件导入)

参数数量: 2
参数1: N, 最小: 0, 最大: 1, 缺省: 1
参数2: X, 最小: 1, 最大: 10, 缺省: 2, 日线: 1

 XA_1:=VALUEWHEN(LOW=LLV(LOW,N),LOW);
 XA_2:=IF(XA_1<REF(XA_1,BARSLAST(XA_1)),XA_1,REF(XA_1,BARSLAST(XA_1)));
 XA_3:=PLOYLINE(XA_2=REF(XA_2,1) AND REF(XA_2,1)<REF(XA_2,2),REF(LOW,1));
 XA_4:=DRAWICON(XA_2=REF(XA_2,1) AND REF(XA_2,1)<REF(XA_2,2),REF(LOW,1),36);
 XA_5:=HOD(CLOSE,N);
 XA_6:=BARSLAST(XA_5=1);
 DRAWTEXT(CROSS(1,XA_6),CLOSE,1),NODRAW;
 DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
 XA_7:=CLOSE/REF(CLOSE,1)>1.095;
 STICKLINE(XA_7,OPEN,CLOSE,0.8,0),COLORYELLOW;
 DRAWTEXT_FIX(1,0,0,0,2),COLOR0080FF;
 DRAWTEXT_FIX(1,0.07,0,0,HYBLOCK),COLOR0080FF;
 DRAWTEXT_FIX(1,0.14,0,0,3),COLORYELLOW;
 DRAWTEXT_FIX(1,0.21,0,0,DYBLOCK),COLORYELLOW;
 DRAWTEXT_FIX(1,0.28,0,0,4),COLORYELLOW;
 DRAWTEXT_FIX(1,0.35,0,0,GNBLOCK),COLORYELLOW;
 DRAWTEXT_FIX(1,0,0.06,0,5),COLORRED;
 DRAWTEXT_FIX(1,0.07,0.06,0,6),COLORRED;
 DRAWNUMBER_FIX(1,0.14,0.06,0,FINANCE(34));
 DRAWTEXT_FIX(1,0.18,0.06,0,7),COLORRED;
 DRAWNUMBER_FIX(1,0.28,0.06,0,FINANCE(32));
 DRAWTEXT_FIX(1,0.32,0.06,0,8),COLORRED;
 DRAWNUMBER_FIX(1,0.4,0.06,0,FINANCE(18));
 XA_8:=SIGNALS_USER(5,1)*100;
 XA_9:=STRCAT(STRCAT(9,CON2STR(XA_8,1)),10);
 DRAWTEXT_FIX(ISLASTBAR,0,0.23,0,XA_9),COLORGREEN;
 XA_10:=STRCAT(STRCAT(11,CON2STR(VOL/CAPITAL/(1-SIGNALS_USER(5,1))*100,1)),10);
 DRAWTEXT_FIX(ISLASTBAR,0.2,0.23,0,XA_10),COLORGREEN;
 XA_11:=STRCAT(12,CON2STR(CLOSE/FINANCE(33),2));
 XA_12:=STRCAT(13,CON2STR(CLOSE/(FINANCE(20)/FINANCE(1)),2));
 XA_13:=STRCAT(14,CON2STR(CLOSE/FINANCE(34),2));
 XA_14:=STRCAT(15,CON2STR(FINANCE(33)/FINANCE(34)*100,2));
 XA_15:=STRCAT(16,CON2STR((FINANCE(20)-FINANCE(21))/FINANCE(20)*100,2));
 XA_16:=STRCAT(17,CON2STR(FINANCE(30)/FINANCE(20)*100,2));
 XA_17:=STRCAT(18,CON2STR(FINANCE(23)/FINANCE(20)*100,2));
 XA_18:=STRCAT(19,STRCAT(STRCAT(STRCAT(STRCAT(STRCAT(STRCAT(XA_11,XA_12),XA_13),XA_14),XA_15),XA_16),XA_17));
 XA_19:=(FINANCE(11)-FINANCE(15))/FINANCE(10)*1.2;
 XA_20:=(FINANCE(31)+FINANCE(17))/FINANCE(10)*1.4;
 XA_21:=FINANCE(23)/FINANCE(10)*3.3;
 XA_22:=FINANCE(19)/FINANCE(15)*0.6;
 XA_23:=FINANCE(20)/FINANCE(15)*0.999;
 XA_24:=XA_19+XA_20+XA_21+XA_22+XA_23;
 XA_25:=IF(XA_24<1.2,20,IF(XA_24>=1.2 AND XA_24<2.6,21,22));
 XA_26:=STRCAT(23,STRCAT(XA_25,STRCAT(24,CON2STR(XA_24,3))));
 XA_27:=STRCAT(25,CON2STR((FINANCE(19)-FINANCE(22)-FINANCE(27))/FINANCE(19),2));
 XA_28:=STRCAT(26,CON2STR(FINANCE(25)/FINANCE(15),3));
 XA_29:=STRCAT(27,STRCAT(STRCAT(XA_26,XA_27),XA_28));
 DRAWTEXT_FIX(1,0.45,0.06,0,28),COLORGREEN;
 DRAWNUMBER_FIX(1,0.51,0.06,0,CONST(FINANCE(43))),COLORGREEN;
 DRAWTEXT_FIX(1,0.55,0.06,0,29),COLORGREEN;
 DRAWNUMBER_FIX(1,0.61,0.06,0,CONST(FINANCE(44))),COLORGREEN;
 DRAWTEXT_FIX(ISLASTBAR,0,0.12,0,XA_18),COLOR0080FF;
 DRAWTEXT_FIX(ISLASTBAR,0,0.17,0,XA_29),COLORGREEN;
 XA_30:=120;
 XA_31:=2;
 XA_32:=1;
统计时长:IF(N,CONST(SUMBARS(VOL/FINANCE(7)*100,XA_31)),XA_30),NODRAW;
 XA_33:=统计时长;
XA_34:=CONST(HHV(HIGH,XA_33));
 XA_35:=CONST(LLV(LOW,XA_33));
 STICKLINE(CURRBARSCOUNT=XA_33,XA_34,XA_35,0,0);
 XA_36:=XA_34-XA_35;
均价:AMOUNT/VOL/100,NODRAW;
 XA_37:=XA_35;
 XA_38:=XA_35*(1+X/10);
 XA_39:=IF(XA_38<=XA_34,XA_38*(1+X/10),DRAWNULL);
 XA_40:=IF(XA_39<=XA_34,XA_39*(1+X/10),DRAWNULL);
 XA_41:=IF(XA_40<=XA_34,XA_40*(1+X/10),DRAWNULL);
 XA_42:=IF(XA_41<=XA_34,XA_41*(1+X/10),DRAWNULL);
 XA_43:=IF(XA_42<=XA_34,XA_42*(1+X/10),DRAWNULL);
 XA_44:=IF(XA_43<=XA_34,XA_43*(1+X/10),DRAWNULL);
 XA_45:=IF(XA_44<=XA_34,XA_44*(1+X/10),DRAWNULL);
 XA_46:=IF(XA_45<=XA_34,XA_45*(1+X/10),DRAWNULL);
 XA_47:=IF(XA_46<=XA_34,XA_46*(1+X/10),DRAWNULL);
 XA_48:=IF(XA_47<=XA_34,XA_47*(1+X/10),DRAWNULL);
 XA_49:=IF(XA_48<=XA_34,XA_48*(1+X/10),DRAWNULL);
 XA_50:=IF(XA_49<=XA_34,XA_49*(1+X/10),DRAWNULL);
 XA_51:=IF(XA_50<=XA_34,XA_50*(1+X/10),DRAWNULL);
 XA_52:=IF(XA_51<=XA_34,XA_51*(1+X/10),DRAWNULL);
 XA_53:=IF(XA_52<=XA_34,XA_52*(1+X/10),DRAWNULL);
 XA_54:=IF(XA_53<=XA_34,XA_53*(1+X/10),DRAWNULL);
 XA_55:=IF(XA_54<=XA_34,XA_54*(1+X/10),DRAWNULL);
 XA_56:=IF(XA_55<=XA_34,XA_55*(1+X/10),DRAWNULL);
 XA_57:=IF(XA_56<=XA_34,XA_56*(1+X/10),DRAWNULL);
 XA_58:=IF(XA_57<=XA_34,XA_57*(1+X/10),DRAWNULL);
 XA_59:=IF(XA_58<=XA_34,XA_58*(1+X/10),DRAWNULL);
 XA_60:=IF(XA_59<=XA_34,XA_59*(1+X/10),DRAWNULL);
 XA_61:=IF(XA_60<=XA_34,XA_60*(1+X/10),DRAWNULL);
 XA_62:=IF(XA_61<=XA_34,XA_61*(1+X/10),DRAWNULL);
 XA_63:=IF(XA_62<=XA_34,XA_62*(1+X/10),DRAWNULL);
 XA_64:=IF(XA_63<=XA_34,XA_63*(1+X/10),DRAWNULL);
 XA_65:=IF(XA_64<=XA_34,XA_64*(1+X/10),DRAWNULL);
 XA_66:=IF(XA_65<=XA_34,XA_65*(1+X/10),DRAWNULL);
 XA_67:=IF(XA_66<=XA_34,XA_66*(1+X/10),DRAWNULL);
 XA_68:=IF(XA_67<=XA_34,XA_67*(1+X/10),DRAWNULL);
 XA_69:=IF(XA_68<=XA_34,XA_68*(1+X/10),DRAWNULL);
 XA_70:=IF(XA_69<=XA_34,XA_69*(1+X/10),DRAWNULL);
 XA_71:=IF(XA_70<=XA_34,XA_70*(1+X/10),DRAWNULL);
 XA_72:=IF(XA_71<=XA_34,XA_71*(1+X/10),DRAWNULL);
 XA_73:=SUM((CURRBARSCOUNT<XA_33+1)*VOL,XA_33);
 XA_74:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_37-0.001,XA_38+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_74*200)),XA_37,XA_37*1.001,5,0),COLORFF5555;
 XA_75:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_38,XA_39+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_75*200)),XA_38,XA_38*1.001,5,0),COLORFFAA55;
 XA_76:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_39,XA_40+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_76*200)),XA_39,XA_39*1.001,5,0),COLORAAFF55;
 XA_77:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_40,XA_41+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_77*200)),XA_40,XA_40*1.001,5,0),COLOR5FFF00;
 XA_78:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_41,XA_42+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_78*200)),XA_41,XA_41*1.001,5,0),COLORFFFFF0;
 XA_79:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_42,XA_43+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_79*200)),XA_42,XA_42*1.001,5,0),COLORFF0FFF;
 XA_80:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_43,XA_44+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_80*200)),XA_43,XA_43*1.001,5,0),COLOR509FDD;
 XA_81:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_44,XA_45+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_81*200)),XA_44,XA_44*1.001,5,0),COLORAA5DDD;
 XA_82:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_45,XA_46+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_82*200)),XA_45,XA_45*1.001,5,0),COLOR0055DD;
 XA_83:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_46,XA_47+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_83*200)),XA_46,XA_46*1.001,5,0);
 XA_84:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_47,XA_48+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_84*200)),XA_47,XA_47*1.001,5,0);
 XA_85:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_48,XA_49+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_85*200)),XA_48,XA_48*1.001,5,0);
 XA_86:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_49,XA_50+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_86*200)),XA_49,XA_49*1.001,5,0);
 XA_87:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_50,XA_51+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_87*200)),XA_50,XA_50*1.001,5,0);
 XA_88:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_51,XA_52+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_88*200)),XA_51,XA_51*1.001,5,0);
 XA_89:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_52,XA_53+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_89*200)),XA_52,XA_52*1.001,5,0);
 XA_90:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_53,XA_54+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_90*200)),XA_53,XA_53*1.001,5,0);
 XA_91:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_54,XA_55+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_91*200)),XA_54,XA_54*1.001,5,0);
 XA_92:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_55,XA_56+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_92*200)),XA_55,XA_55*1.001,5,0);
 XA_93:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_56,XA_57+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_93*200)),XA_56,XA_56*1.001,5,0);
 XA_94:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_57,XA_58+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_94*200)),XA_57,XA_57*1.001,5,0);
 XA_95:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_58,XA_59+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_95*200)),XA_58,XA_58*1.001,5,0);
 XA_96:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_59,XA_60+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_96*200)),XA_59,XA_59*1.001,5,0);
 XA_97:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_60,XA_61+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_97*200)),XA_60,XA_60*1.001,5,0);
 XA_98:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_61,XA_62+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_98*200)),XA_61,XA_61*1.001,5,0);
 XA_99:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_62,XA_63+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_99*200)),XA_62,XA_62*1.001,5,0);
 XA_100:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_63,XA_64+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_100*200)),XA_63,XA_63*1.001,5,0);
 XA_101:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_64,XA_65+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_101*200)),XA_64,XA_64*1.001,5,0);
 XA_102:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_65,XA_66+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_102*200)),XA_65,XA_65*1.001,5,0);
 XA_103:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_66,XA_67+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_103*200)),XA_66,XA_66*1.001,5,0);
 XA_104:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_67,XA_68+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_104*200)),XA_67,XA_67*1.001,5,0);
 XA_105:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_68,XA_69+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_105*200)),XA_68,XA_68*1.001,5,0);
 XA_106:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_69,XA_70+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_106*200)),XA_69,XA_69*1.001,5,0);
 XA_107:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_70,XA_71+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_107*200)),XA_70,XA_70*1.001,5,0);
 XA_108:=SUM((CURRBARSCOUNT<XA_33+1 AND RANGE(均价,XA_71,XA_72+0.001))*VOL,XA_33)/XA_73;
 STICKLINE(CURRBARSCOUNT<CONST(INTPART(XA_108*200)),XA_71,XA_71*1.001,5,0);

1330577789.jpg

1330577789.jpg

回复

使用道具 举报

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

本版积分规则