通达信缠论套利主图指标 预测趋势拐点 源码附图
X_1:=1;
X_2:=MA(CLOSE,5);
X_3:=MA(CLOSE,10);
X_4:=REF(HIGH,5)=HHV(HIGH,11);
X_5:=REF(LOW,5)=LLV(LOW,11);
X_6:=BACKSET(X_4,6)>BACKSET(X_4,5);
X_7:=BACKSET(X_5,6)>BACKSET(X_5,5);
X_8:=IF(BARSLAST(X_6)=BARSLAST(X_7) AND X_2>X_3,X_6,IF(BARSLAST(X_7)>BARSLAST(X_6),X_6,0));
X_9:=IF(BARSLAST(X_6)=BARSLAST(X_7) AND X_3>X_2,X_7,IF(BARSLAST(X_6)>BARSLAST(X_7),X_7,0));
X_10:=X_8 AND HIGH=HHV(HIGH,BARSLAST(X_9));
X_11:=X_9 AND LOW=LLV(LOW,BARSLAST(X_8));
GP:IF(X_10,HIGH,DRAWNULL),CIRCLEDOT,COLORCYAN;
DP:IF(X_11,LOW,DRAWNULL),CIRCLEDOT,COLORCYAN;
X_12:=LOW>REF(HIGH,1) AND DAY!=REF(DAY,1);
X_13:=HIGH<REF(LOW,1) AND DAY!=REF(DAY,1);
X_14:=REF(LOW,BARSLAST(X_12));
X_15:=REF(HIGH,BARSLAST(X_13));
X_16:=REF(HIGH,BARSLAST(X_10));
X_17:=REF(LOW,BARSLAST(X_10));
X_18:=REF(HIGH,BARSLAST(X_10)+1);
X_19:=REF(LOW,BARSLAST(X_10)+1);
X_20:=REF(HIGH,BARSLAST(X_10)+2);
X_21:=REF(LOW,BARSLAST(X_10)+2);
X_22:=REF(HIGH,BARSLAST(X_11));
X_23:=REF(LOW,BARSLAST(X_11));
X_24:=REF(HIGH,BARSLAST(X_11)+1);
X_25:=REF(LOW,BARSLAST(X_11)+1);
X_26:=REF(HIGH,BARSLAST(X_11)+2);
X_27:=REF(LOW,BARSLAST(X_11)+2);
X_28:=IF(X_17<=X_19,X_20,X_18);
X_29:=IF(X_18<X_17,X_17,IF(X_17<=X_19,X_21,X_19));
X_30:=IF(X_25>X_22,X_22,IF(X_22>=X_24,X_26,X_24));
X_31:=IF(X_22>=X_24,X_27,X_25);
X_32:=X_16>X_30 AND X_10;
X_33:=X_23<X_29 AND X_11;
X_34:=X_32 AND X_16>X_22 AND X_17>X_23 AND X_19>X_23;
X_35:=X_33 AND X_23<X_17 AND X_22<X_16 AND X_24<X_16;
X_36:=HIGH<=REF(HIGH,1) AND LOW>=REF(LOW,1) OR (HIGH>=REF(HIGH,1) AND LOW<=REF(LOW,1));
X_37:=COUNT(X_36,BARSLAST(X_11));
X_38:=COUNT(X_36,BARSLAST(X_10));
X_39:=COUNT(X_12,BARSLAST(X_11));
X_40:=COUNT(X_13,BARSLAST(X_10));
X_41:=IF(X_37>0,X_37+2+X_1,IF(X_38,X_38+2+X_1,3));
X_42:=IF(X_39,X_41-X_39,IF(X_40,X_41-X_40,X_41));
X_43:=X_34 AND BARSLAST(X_35)>X_42;
X_44:=X_35 AND BARSLAST(X_34)>X_42;
X_45:=X_10 AND REF(HIGH,BARSLAST(X_10))>=REF(HIGH,BARSLAST(X_43)) AND BARSLAST(X_44)>BARSLAST(X_43) OR (X_32 AND COUNT(X_12,BARSLAST(X_33))>0 AND REF(HIGH,BARSLAST(X_32))>REF(HIGH,BARSLAST(X_43)));
X_46:=X_11 AND REF(LOW,BARSLAST(X_11))<=REF(LOW,BARSLAST(X_44)) AND BARSLAST(X_43)>BARSLAST(X_44) OR (X_33 AND COUNT(X_13,BARSLAST(X_32))>0 AND REF(LOW,BARSLAST(X_33))<REF(HIGH,BARSLAST(X_44)));
X_47:=IF(BARSLAST(X_46)>BARSLAST(X_45),REF(HIGH,BARSLAST(X_45)),REF(HIGH,BARSLAST(X_46)));
X_48:=IF(BARSLAST(X_45)>BARSLAST(X_46),REF(LOW,BARSLAST(X_46)),REF(LOW,BARSLAST(X_45)));
X_49:=X_45 AND HIGH=HHV(X_47,BARSLAST(X_46)+1) AND HIGH>REF(HIGH,1) AND BARSLAST(X_46)>BARSLAST(X_45);
X_50:=X_46 AND LOW=LLV(X_48,BARSLAST(X_45)+1) AND LOW<REF(LOW,1) AND BARSLAST(X_45)>BARSLAST(X_46);
X_51:=X_49 OR (X_10 AND REF(HIGH,BARSLAST(X_10))>REF(HIGH,BARSLAST(X_49)) AND BARSLAST(X_50)>BARSLAST(X_49));
X_52:=X_50 OR (X_11 AND REF(LOW,BARSLAST(X_11))<REF(LOW,BARSLAST(X_50)) AND BARSLAST(X_49)>BARSLAST(X_50));
GPB:IF(X_43,HIGH,DRAWNULL),CIRCLEDOT,COLORYELLOW;
DPB:IF(X_44,LOW,DRAWNULL),CIRCLEDOT,COLORYELLOW;
X_53:=X_51;
X_54:=X_52;
L1:DRAWLINE(X_54,LOW,X_53,HIGH,0),COLORYELLOW;
L2:DRAWLINE(X_53,HIGH,X_54,LOW,0),COLORWHITE;
X_55:=CLOSE;
X_56:=FILTER(BACKSET(FILTER(REF(X_55,10)=HHV(X_55,2*10+1),10),10+1),10);
X_57:=FILTER(BACKSET(FILTER(REF(X_55,10)=LLV(X_55,2*10+1),10),10+1),10);
X_58:=REF(CLOSE,BARSLAST(X_56));
X_59:=REF(CLOSE,BARSLAST(X_57));
X_60:=BARSLAST(X_56)<BARSLAST(X_57) AND NOT(X_56);
X_61:=BARSLAST(X_56)>BARSLAST(X_57) AND NOT(X_57);
波段顶:IF(X_60,X_58,X_58),POINTDOT,COLORLIGREEN,LINETHICK4;
波段底:IF(X_61,X_59,X_59),POINTDOT,COLORMAGENTA,LINETHICK4;
未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
X_1赋值:1
X_2赋值:收盘价的5日简单移动平均
X_3赋值:收盘价的10日简单移动平均
X_4赋值:5日前的最高价=11日内最高价最高值
X_5赋值:5日前的最低价=11日内最低价最低值
X_6赋值:BACKSET(X_4,6)>BACKSET(X_4,5)
X_7赋值:BACKSET(X_5,6)>BACKSET(X_5,5)
X_8赋值:IF(上次X_6距今天数=BARSLAST(X_7) AND X_2>X_3,X_6,IF(BARSLAST(X_7)>上次X_6距今天数,X_6,0))
X_9赋值:IF(上次X_6距今天数=BARSLAST(X_7) AND X_3>X_2,X_7,IF(上次X_6距今天数>BARSLAST(X_7),X_7,0))
X_10:=X_8 AND 最高价=HHV(最高价,上次X_9距今天数)
X_11:=X_9 AND 最低价=LLV(最低价,上次X_8距今天数)
如果X_10返回最高价否则返回DRAWNULL
如果X_11返回最低价否则返回DRAWNULL
X_12:=最低价>1日前的最高价 AND DAY!=1日前的DAY
X_13:=最高价<1日前的最低价 AND DAY!=1日前的DAY
X_14:=REF(最低价,上次X_12距今天数)
X_15:=REF(最高价,上次X_13距今天数)
X_16:=REF(最高价,上次X_10距今天数)
X_17:=REF(最低价,上次X_10距今天数)
X_18:=REF(最高价,上次X_10距今天数+1)
X_19:=REF(最低价,上次X_10距今天数+1)
X_20:=REF(最高价,上次X_10距今天数+2)
X_21:=REF(最低价,上次X_10距今天数+2)
X_22:=REF(最高价,上次X_11距今天数)
X_23:=REF(最低价,上次X_11距今天数)
X_24:=REF(最高价,上次X_11距今天数+1)
X_25:=REF(最低价,上次X_11距今天数+1)
X_26:=REF(最高价,上次X_11距今天数+2)
X_27:=REF(最低价,上次X_11距今天数+2)
如果X_17<=X_19返回X_20否则返回X_18
X_29:=IF(X_18
X_30:=IF(X_25>X_22,X_22,IF(X_22>=X_24,X_26,X_24))
如果X_22>=X_24返回X_27否则返回X_25
X_32:=X_16>X_30 AND X_10
X_33:=X_23
X_34:=X_32 AND X_16>X_22 AND X_17>X_23 AND X_19>X_23
X_35:=X_33 AND X_23
X_36:=最高价<=1日前的最高价 AND 最低价>=1日前的最低价 OR (最高价>=1日前的最高价 AND 最低价<=1日前的最低价)
X_37:=COUNT(X_36,上次X_11距今天数)
X_38:=COUNT(X_36,上次X_10距今天数)
X_39:=COUNT(X_12,上次X_11距今天数)
X_40:=COUNT(X_13,上次X_10距今天数)
X_41:=IF(X_37>0,X_37+2+X_1,IF(X_38,X_38+2+X_1,3))
X_42:=IF(X_39,X_41-X_39,IF(X_40,X_41-X_40,X_41))
X_43:=X_34 AND 上次X_35距今天数>X_42
X_44:=X_35 AND 上次X_34距今天数>X_42
X_45:=X_10 AND REF(最高价,上次X_10距今天数)>=REF(最高价,BARSLAST(X_43)) AND BARSLAST(X_44)>BARSLAST(X_43) OR (X_32 AND COUNT(X_12,BARSLAST(X_33))>0 AND REF(最高价,BARSLAST(X_32))>REF(最高价,BARSLAST(X_43)))
X_46:=X_11 AND REF(最低价,上次X_11距今天数)<=REF(最低价,BARSLAST(X_44)) AND BARSLAST(X_43)>BARSLAST(X_44) OR (X_33 AND COUNT(X_13,BARSLAST(X_32))>0 AND REF(最低价,BARSLAST(X_33))[
X_47:=IF(上次X_46距今天数>BARSLAST(X_45),REF(最高价,BARSLAST(X_45)),REF(最高价,上次X_46距今天数))]
X_48:=IF(上次X_45距今天数>BARSLAST(X_46),REF(最低价,BARSLAST(X_46)),REF(最低价,上次X_45距今天数))
X_49:=X_45 AND 最高价=HHV(X_47,上次X_46距今天数+1) AND 最高价>1日前的最高价 AND 上次X_46距今天数>BARSLAST(X_45)
X_50:=X_46 AND 最低价=LLV(X_48,上次X_45距今天数+1) AND 最低价<1日前的最低价 AND 上次X_45距今天数>BARSLAST(X_46)
X_51:=X_49 OR (X_10 AND REF(最高价,上次X_10距今天数)>REF(最高价,BARSLAST(X_49)) AND BARSLAST(X_50)>BARSLAST(X_49))
X_52:=X_50 OR (X_11 AND REF(最低价,上次X_11距今天数)[BARSLAST(X_50))]
如果X_43返回最高价否则返回DRAWNULL
如果X_44返回最低价否则返回DRAWNULL
X_53:=X_51
X_54:=X_52
输出L1:DRAWLINE(X_54,最低价,X_53,最高价,0),画黄色
输出L2:DRAWLINE(X_53,最高价,X_54,最低价,0),画白色
X_55:=收盘价
X_56:=FILTER(BACKSET(FILTER(10日前的X_55=2*10+1日内X_55最高值,10),10+1),10)
X_57:=FILTER(BACKSET(FILTER(10日前的X_55=2*10+1日内X_55最低值,10),10+1),10)
X_58:=REF(收盘价,上次X_56距今天数)
X_59:=REF(收盘价,上次X_57距今天数)
X_60:=上次X_56距今天数
X_61:=上次X_56距今天数>BARSLAST(X_57) AND NOT(X_57)
如果X_60返回X_58否则返回X_58
如果X_61返回X_59否则返回X_59