通达信TD组合公式 源码
HJ_1:=IF(CLOSE>OPEN,HIGH-CLOSE,HIGH-OPEN);
HJ_2:=IF(CLOSE>OPEN,OPEN-LOW,CLOSE-LOW);
HJ_3:=MA(HJ_1,60)*1.5;
HJ_4:=MA(HJ_2,60)*1.5;
HJ_5:=IF((CLOSE-REF(CLOSE,1))*100/REF(CLOSE,1)>=10-0.01*100/REF(CLOSE,1),1,0);
HJ_6:=IF((REF(CLOSE,1)-CLOSE)*100/REF(CLOSE,1)>=10-0.01*100/REF(CLOSE,1),1,0);
STICKLINE(HJ_5,OPEN,CLOSE,2,0),COLORYELLOW;
STICKLINE(HJ_6,OPEN,CLOSE,2,0),COLORBLUE;
HJ_7:=CLOSE>REF(CLOSE,4);
HJ_8:=BARSLASTCOUNT(HJ_7);
HJ_9:=HJ_8=9;{}
HJ_10:=ISLASTBAR AND BETWEEN(HJ_8,1,8);
HJ_11:=(BACKSET(HJ_9>0,9) OR BACKSET(HJ_10>0,HJ_8))*HJ_8;
DRAWNUMBER(HJ_11>0,HIGH+HJ_3*2,HJ_11),COLORMAGENTA;
DRAWNUMBER(HJ_8=9 AND HIGH>REF(HIGH,2),HIGH+HJ_3*2,9),COLORGREEN;
DRAWNUMBER(HJ_8=18,HIGH+HJ_3*2,18),COLORYELLOW;
HJ_12:=CLOSE<REF(CLOSE,4);
HJ_13:=BARSLASTCOUNT(HJ_12);
HJ_14:=HJ_13=9;
HJ_15:=ISLASTBAR AND BETWEEN(HJ_13,1,8);
HJ_16:=(BACKSET(HJ_14>0,9) OR BACKSET(HJ_15>0,HJ_13))*HJ_13;
DRAWNUMBER(HJ_16>0,LOW-HJ_4*2,HJ_16),COLORMAGENTA;
DRAWNUMBER(HJ_13=9 AND LOW<REF(LOW,2),LOW-HJ_4*2,9),COLORGREEN;
DRAWNUMBER(HJ_13=18,LOW-HJ_4*2,18),COLORYELLOW;
HJ_17:=BARSLAST(HJ_8=9);
HJ_18:=COUNT(HJ_12,HJ_17)<=0;
HJ_19:=COUNT(HJ_7,HJ_17)=0;
HJ_20:=COUNT(CLOSE>REF(HIGH,2) AND HJ_18,HJ_17);
DRAWNUMBER(HJ_20=3 AND REF(HJ_20,1)=2,HIGH+HJ_3*2,12),COLOR0080FF;
HJ_21:=IF(HJ_20=4 AND REF(HJ_20,1)=3 AND HIGH>REF(CLOSE,HJ_17+1),2,IF(HJ_20=4 AND REF(HJ_20,1)=3,1,0));
DRAWNUMBER(HJ_21=2,HIGH+HJ_3*2,13),COLORGREEN;
DRAWNUMBER(HJ_21=1,HIGH+HJ_3*2,0),COLORGREEN;
HJ_22:=BARSLAST(HJ_13=9);
HJ_23:=COUNT(HJ_7,HJ_22)<=0;
HJ_24:=COUNT(HJ_12,HJ_22)<=0;
HJ_25:=COUNT(CLOSE<REF(LOW,2) AND HJ_23,HJ_22);
DRAWNUMBER(HJ_25=3 AND REF(HJ_25,1)=2,LOW-HJ_4*2,12),COLOR0080FF;
HJ_26:=IF(HJ_25=4 AND REF(HJ_25,1)=3 AND LOW<REF(CLOSE,HJ_22+1),2,IF(HJ_25=4 AND REF(HJ_25,1)=3,1,0));
DRAWNUMBER(HJ_26=2,LOW-HJ_4*2,13),COLORRED;
DRAWNUMBER(HJ_26=1,LOW-HJ_4*2,0),COLORRED;
HJ_27:=BARSLAST(HJ_26=2);{}
HJ_28:=COUNT(CLOSE>REF(CLOSE,4),HJ_27);
HJ_29:=REF(HJ_28,1)=0 AND HJ_28=1;
HJ_30:=COUNT(CLOSE>REF(HIGH,2),HJ_27);
HJ_31:=REF(HJ_30,1)=0 AND HJ_30=1 AND BARSCOUNT(CLOSE)>9 AND HJ_27<HJ_22;
HJ_32:=BARSLAST(HJ_31);
HJ_33:=IF(HJ_31,HJ_22+9,DRAWNULL);
HJ_34:=LLVBARS(LOW,HJ_33);
HJ_35:=REF(LOW,HJ_34)-(MAX(REF(HIGH,HJ_34),REF(HIGH,HJ_34+1))-REF(LOW,HJ_34));
HJ_36:=REF(LOW,HJ_34)-(REF(CLOSE,HJ_34)-REF(LOW,HJ_34));
STICKLINE(HJ_31,LOW,HJ_36,0.5,(-1)),COLORGREEN;
STICKLINE(HJ_32>0 AND HJ_32<20,REF(HJ_36,HJ_32),REF(HJ_36,HJ_32),1,0),COLORGREEN;
DRAWNUMBER(HJ_31,HJ_36,HJ_36),COLORGREEN;
HJ_37:=COUNT(HJ_13=18,3)>0;
HJ_38:=IF(HJ_8=9 AND (HIGH<REF(HHV(HIGH,12),1) OR CLOSE<OPEN),1,0);
HJ_39:=IF(HJ_21=2 OR HJ_21=1 AND (HIGH<REF(HHV(HIGH,HJ_22+13),1) OR CLOSE<OPEN),1,0);
DRAWICON(HJ_39=1,HIGH+HJ_3*4,8);
DRAWICON(HJ_38=1,HIGH+HJ_3*4,8);
DRAWICON(HJ_8=18,HIGH+HJ_3*4,8);
DRAWICON(HJ_31,LOW-HJ_4*2,7);
HJ_40:=0;{}
HJ_41:=IF(HJ_40=0,LOW,CLOSE);
HJ_42:=IF(HJ_8=9 AND HIGH=HHV(HIGH,9) AND CLOSE>OPEN,1,0);
HJ_43:=BARSLAST(HJ_42=1);
HJ_44:=REF(HJ_41,HJ_43)-(REF(HIGH,HJ_43)-REF(CLOSE,HJ_43));
STICKLINE(HJ_42=1,HJ_41,HJ_41-(HIGH-CLOSE),0.5,(-1)),COLORRED;
STICKLINE(HJ_43>0 AND HJ_43<20,REF(HJ_44,HJ_43),REF(HJ_44,HJ_43),1,0),COLORRED;
DRAWNUMBER(HJ_42=1,HJ_44,HJ_44),COLORRED;
HJ_45:=IF(HJ_40=1,CLOSE<REF(LOW,2) AND LOW<REF(LOW,1) AND CLOSE<REF(CLOSE,1),CLOSE<REF(LOW,2) AND LOW<REF(LOW,1));
HJ_46:=IF(HJ_13=9,BARSLAST(HJ_13=1),DRAWNULL);
HJ_47:=COUNT(HJ_45,HJ_46+5);
HJ_48:=IF(HJ_13=9,HJ_47,DRAWNULL);
HJ_49:=COUNT(HJ_45 AND HJ_23,HJ_22);
HJ_50:=REF(HJ_48,HJ_22)+HJ_49;
HJ_51:=REF(HJ_50,1)=12 AND HJ_50=13;
HJ_52:=BARSLAST(HJ_51);
HJ_53:=COUNT(CLOSE>REF(HIGH,2) AND HJ_52<HJ_22 AND HJ_22<HJ_22+9,HJ_52);
HJ_54:=REF(HJ_53,1)=0 AND HJ_53=1 AND BARSCOUNT(CLOSE)>9;
DRAWICON(HJ_51,LOW-HJ_4*4,25);
DRAWICON(HJ_54,LOW-HJ_4*4,26);
HJ_55:=CLOSE>REF(HIGH,2) AND HIGH>REF(HIGH,1);
HJ_56:=IF(HJ_8=9,BARSLAST(HJ_8=1),DRAWNULL);
HJ_57:=COUNT(HJ_55,HJ_56+5);
HJ_58:=IF(HJ_8=9,HJ_57,DRAWNULL);
HJ_59:=COUNT(HJ_55 AND HJ_18,HJ_17);
HJ_60:=REF(HJ_58,HJ_17)+HJ_59;
HJ_61:=REF(HJ_60,1)=12 AND HJ_60=13;
HJ_62:=BARSLAST(HJ_61);
DRAWICON(HJ_61,HIGH+HJ_3*6,27);
HJ_63:=BARSLAST(HJ_39=1);
HJ_64:=IF(HJ_39=1,REF(HIGH,HHVBARS(HIGH,HJ_17)),DRAWNULL);
STICKLINE(HJ_39=1,HIGH,HJ_64,0.5,(-1)),COLORLIGRAY;
STICKLINE(HJ_63>0 AND HJ_63<30,REF(HJ_64,HJ_63),REF(HJ_64,HJ_63),1,(-1)),COLORLIGRAY;
HJ_65:=BARSLAST(HJ_38=1);
HJ_66:=IF(HJ_38=1,REF(HIGH,HHVBARS(HIGH,13)),DRAWNULL);
STICKLINE(HJ_38=1,HIGH,HJ_66,0.5,(-1)),COLORGREEN;
STICKLINE(HJ_65>0 AND HJ_65<30,REF(HJ_66,HJ_65),REF(HJ_66,HJ_65),1,(-1)),COLORGREEN;
HJ_67:=BARSLAST(HJ_8=18);
HJ_68:=IF(HJ_8=18,REF(HIGH,HHVBARS(HIGH,21)),DRAWNULL);
STICKLINE(HJ_8=18,HIGH,HJ_68,0.5,(-1)),COLORYELLOW;
STICKLINE(HJ_67>0 AND HJ_67<30,REF(HJ_68,HJ_67),REF(HJ_68,HJ_67),1,(-1)),COLORYELLOW;
HJ_69:=IF(HJ_61,REF(HIGH,HHVBARS(HIGH,13)),DRAWNULL);
STICKLINE(HJ_61,HIGH,HJ_69,0.5,(-1)),COLORWHITE;
STICKLINE(HJ_62>0 AND HJ_62<30,REF(HJ_69,HJ_62),REF(HJ_69,HJ_62),1,(-1)),COLORWHITE;
{-----------------------------------}
未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
如果收盘价>开盘价返回最高价-收盘价否则返回最高价-开盘价
如果收盘价>开盘价返回开盘价-最低价否则返回收盘价-最低价
HJ_3赋值:HJ_1的60日简单移动平均*1.5
HJ_4赋值:HJ_2的60日简单移动平均*1.5
HJ_5赋值:IF((收盘价-1日前的收盘价)*100/1日前的收盘价>=10-0.01*100/1日前的收盘价,1,0)
HJ_6赋值:IF((1日前的收盘价-收盘价)*100/1日前的收盘价>=10-0.01*100/1日前的收盘价,1,0)
当满足条件HJ_5时,在开盘价和收盘价之间画柱状线
当满足条件HJ_6时,在开盘价和收盘价之间画柱状线
HJ_7赋值:收盘价>4日前的收盘价
HJ_8赋值:BARSLASTCOUNT(HJ_7)
HJ_9赋值:HJ_8=9
{}
HJ_10:=ISLASTBAR AND BETWEEN(HJ_8,1,8)
HJ_11:=(BACKSET(HJ_9>0,9) OR BACKSET(HJ_10>0,HJ_8))*HJ_8
DRAWNUMBER(HJ_11>0,最高价+HJ_3*2,HJ_11),画洋红色
DRAWNUMBER(HJ_8=9 AND 最高价>2日前的最高价,最高价+HJ_3*2,9),画绿色
DRAWNUMBER(HJ_8=18,最高价+HJ_3*2,18),画黄色
HJ_12:=收盘价<4日前的收盘价
HJ_13:=BARSLASTCOUNT(HJ_12)
HJ_14:=HJ_13=9
HJ_15:=ISLASTBAR AND BETWEEN(HJ_13,1,8)
HJ_16:=(BACKSET(HJ_14>0,9) OR BACKSET(HJ_15>0,HJ_13))*HJ_13
DRAWNUMBER(HJ_16>0,最低价-HJ_4*2,HJ_16),画洋红色
DRAWNUMBER(HJ_13=9 AND 最低价<2日前的最低价,最低价-HJ_4*2,9),画绿色
DRAWNUMBER(HJ_13=18,最低价-HJ_4*2,18),画黄色
HJ_17:=上次HJ_8=9距今天数
HJ_18:=统计HJ_17日满足HJ_12的天数<=0
HJ_19:=统计HJ_17日满足HJ_7的天数=0
HJ_20:=COUNT(收盘价>2日前的最高价 AND HJ_18,HJ_17)
DRAWNUMBER(HJ_20=3 AND 1日前的HJ_20=2,最高价+HJ_3*2,12),COLOR0080FF
HJ_21:=IF(HJ_20=4 AND 1日前的HJ_20=3 AND 最高价>HJ_17+1日前的收盘价,2,IF(HJ_20=4 AND 1日前的HJ_20=3,1,0))
DRAWNUMBER(HJ_21=2,最高价+HJ_3*2,13),画绿色
DRAWNUMBER(HJ_21=1,最高价+HJ_3*2,0),画绿色
HJ_22:=上次HJ_13=9距今天数
HJ_23:=统计HJ_22日满足HJ_7的天数<=0
HJ_24:=统计HJ_22日满足HJ_12的天数<=0
HJ_25:=COUNT(收盘价<2日前的最低价 AND HJ_23,HJ_22)
DRAWNUMBER(HJ_25=3 AND 1日前的HJ_25=2,最低价-HJ_4*2,12),COLOR0080FF
HJ_26:=IF(HJ_25=4 AND 1日前的HJ_25=3 AND 最低价
DRAWNUMBER(HJ_26=2,最低价-HJ_4*2,13),画红色
DRAWNUMBER(HJ_26=1,最低价-HJ_4*2,0),画红色
HJ_27:=上次HJ_26=2距今天数
{}
HJ_28:=COUNT(收盘价>4日前的收盘价,HJ_27)
HJ_29:=1日前的HJ_28=0 AND HJ_28=1
HJ_30:=COUNT(收盘价>2日前的最高价,HJ_27)
HJ_31:=1日前的HJ_30=0 AND HJ_30=1 AND 收盘价的有效数据周期数>9 AND HJ_27
HJ_32:=上次HJ_31距今天数
如果HJ_31返回HJ_22+9否则返回DRAWNULL
HJ_34:=LLVBARS(最低价,HJ_33)
HJ_35:=HJ_34日前的最低价-(HJ_34日前的最高价和HJ_34+1日前的最高价较大值-HJ_34日前的最低价)
HJ_36:=HJ_34日前的最低价-(HJ_34日前的收盘价-HJ_34日前的最低价)
STICKLINE(HJ_31,最低价,HJ_36,0.5,(-1)),画绿色
STICKLINE(HJ_32>0 AND HJ_32<20,HJ_32日前的HJ_36,HJ_32日前的HJ_36,1,0),画绿色
DRAWNUMBER(HJ_31,HJ_36,HJ_36),画绿色
HJ_37:=统计3日满足HJ_13=18的天数>0
HJ_38:=IF(HJ_8=9 AND (最高价
HJ_39:=IF(HJ_21=2 OR HJ_21=1 AND (最高价[当满足条件HJ_39=1时,在最高价+HJ_3*4和8之间画图标]
当满足条件HJ_38=1时,在最高价+HJ_3*4和8之间画图标
当满足条件HJ_8=18时,在最高价+HJ_3*4和8之间画图标
当满足条件HJ_31时,在最低价-HJ_4*2和7之间画图标
HJ_40:=0
如果HJ_40=0返回最低价否则返回收盘价
HJ_42:=IF(HJ_8=9 AND 最高价=9日内最高价最高值 AND 收盘价>开盘价,1,0)
HJ_43:=上次HJ_42=1距今天数
HJ_44:=HJ_43日前的HJ_41-(HJ_43日前的最高价-HJ_43日前的收盘价)
STICKLINE(HJ_42=1,HJ_41,HJ_41-(最高价-收盘价),0.5,(-1)),画红色
STICKLINE(HJ_43>0 AND HJ_43<20,HJ_43日前的HJ_44,HJ_43日前的HJ_44,1,0),画红色
DRAWNUMBER(HJ_42=1,HJ_44,HJ_44),画红色
HJ_45:=IF(HJ_40=1,收盘价<2日前的最低价 AND 最低价<1日前的最低价 AND 收盘价<1日前的收盘价,收盘价<2日前的最低价 AND 最低价<1日前的最低价)
HJ_46:=IF(HJ_13=9,上次HJ_13=1距今天数,DRAWNULL)
HJ_47:=统计HJ_46+5日满足HJ_45的天数
如果HJ_13=9返回HJ_47否则返回DRAWNULL
HJ_49:=统计HJ_22日满足HJ_45 AND HJ_23的天数
HJ_50:=HJ_22日前的HJ_48+HJ_49
HJ_51:=1日前的HJ_50=12 AND HJ_50=13
HJ_52:=上次HJ_51距今天数
HJ_53:=COUNT(收盘价>2日前的最高价 AND HJ_52
HJ_54:=1日前的HJ_53=0 AND HJ_53=1 AND 收盘价的有效数据周期数>9
当满足条件HJ_51时,在最低价-HJ_4*4和25之间画图标
当满足条件HJ_54时,在最低价-HJ_4*4和26之间画图标
HJ_55:=收盘价>2日前的最高价 AND 最高价>1日前的最高价
HJ_56:=IF(HJ_8=9,上次HJ_8=1距今天数,DRAWNULL)
HJ_57:=统计HJ_56+5日满足HJ_55的天数
如果HJ_8=9返回HJ_57否则返回DRAWNULL
HJ_59:=统计HJ_17日满足HJ_55 AND HJ_18的天数
HJ_60:=HJ_17日前的HJ_58+HJ_59
HJ_61:=1日前的HJ_60=12 AND HJ_60=13
HJ_62:=上次HJ_61距今天数
当满足条件HJ_61时,在最高价+HJ_3*6和27之间画图标
HJ_63:=上次HJ_39=1距今天数
HJ_64:=IF(HJ_39=1,REF(最高价,HHVBARS(最高价,HJ_17)),DRAWNULL)
STICKLINE(HJ_39=1,最高价,HJ_64,0.5,(-1)),COLORLIGRAY
STICKLINE(HJ_63>0 AND HJ_63<30,HJ_63日前的HJ_64,HJ_63日前的HJ_64,1,(-1)),COLORLIGRAY
HJ_65:=上次HJ_38=1距今天数
HJ_66:=IF(HJ_38=1,REF(最高价,HHVBARS(最高价,13)),DRAWNULL)
STICKLINE(HJ_38=1,最高价,HJ_66,0.5,(-1)),画绿色
STICKLINE(HJ_65>0 AND HJ_65<30,HJ_65日前的HJ_66,HJ_65日前的HJ_66,1,(-1)),画绿色
HJ_67:=上次HJ_8=18距今天数
HJ_68:=IF(HJ_8=18,REF(最高价,HHVBARS(最高价,21)),DRAWNULL)
STICKLINE(HJ_8=18,最高价,HJ_68,0.5,(-1)),画黄色
STICKLINE(HJ_67>0 AND HJ_67<30,HJ_67日前的HJ_68,HJ_67日前的HJ_68,1,(-1)),画黄色
HJ_69:=IF(HJ_61,REF(最高价,HHVBARS(最高价,13)),DRAWNULL)
STICKLINE(HJ_61,最高价,HJ_69,0.5,(-1)),画白色
STICKLINE(HJ_62>0 AND HJ_62<30,HJ_62日前的HJ_69,HJ_62日前的HJ_69,1,(-1)),画白色
{-----------------------------------}