通达信独库波段买点副图指标 可以据此机械化操作 源码附图
X_1:=REF(CLOSE,1);
X_2:=SMA(MAX(CLOSE-X_1,0),5,1)/SMA(ABS(CLOSE-X_1),5,1)*100;
X_3:=SMA(X_2,5,1);
X_4:=BARSLAST(X_2<=15)<5;
X_5:=SMA(X_2,5,1);
X_6:=CROSS(X_2,X_3) AND X_5>15 AND X_4;
X_7:=FILTER(X_6,10);
X_8:=IF(CLOSE>REF((6*HIGH+5*REF(HIGH,1)+4*REF(HIGH,2)+3*REF(HIGH,3)+2*REF(HIGH,4)+1*REF(HIGH,5))/(6+5+4+3+2+1),1),1,IF(CLOSE<REF((6*LOW+5*REF(LOW,1)+4*REF(LOW,2)+3*REF(LOW,3)+2*REF(LOW,4)+1*REF(LOW,5))/(6+5+4+3+2+1),1),(-1),0));
X_9:=BARSLAST(NOT(X_8=0));
X_10:=IF(X_8=0,REF(X_8,X_9),X_8);
触发:X_7,NODRAW,COLORRED;
止损:CLOSE<REF(OPEN,BARSLAST(X_7>0)) AND COUNT(CLOSE<REF(OPEN,BARSLAST(X_7>0)),BARSLAST(X_7>0))=1 AND IF(MA(CLOSE,1)>IF(X_10=(-1),MA(HIGH,6),MA(LOW,6)),1,(-1))>0,NODRAW,COLORWHITE;
止盈:HIGH/REF(CLOSE,BARSLAST(X_7>0))>=1.05 OR CLOSE/REF(CLOSE,BARSLAST(X_7>0))>=1.05 AND COUNT(止损,BARSLAST(X_7>0))=0 AND COUNT(CROSS(0,IF(MA(CLOSE,1)>IF(X_10=(-1),MA(HIGH,6),MA(LOW,6)),1,(-1))),BARSLAST(X_7>0))=0,NODRAW,COLORBLUE;
区间:COUNT(X_7,BARSLAST(X_7)+1)=1 AND COUNT(止损,BARSLAST(X_7>0)+1)=0 AND COUNT(CROSS(0,IF(MA(CLOSE,1)>IF(X_10=(-1),MA(HIGH,6),MA(LOW,6)),1,(-1))),BARSLAST(X_7>0)+1)=0,NODRAW,COLOR696960;
结束:COUNT(X_7,BARSLAST(X_7)+1)=1 AND COUNT(止损,BARSLAST(X_7>0)+1)=0 AND COUNT(CROSS(0,IF(MA(CLOSE,1)>IF(X_10=(-1),MA(HIGH,5),MA(LOW,5)),1,(-1))),BARSLAST(X_7>0)+1)=1 AND CROSS(0,IF(MA(CLOSE,1)>IF(X_10=(-1),MA(HIGH,6),MA(LOW,5)),1,(-1))) OR 止损,NODRAW,COLORGREEN;
STICKLINE(触发>0,0,1,(-1),0),COLORRED;
STICKLINE(止盈>0,0.4,0.6,4,0),COLORBLUE;
STICKLINE(结束>0,0,0.7,(-1),0),COLORGREEN;
STICKLINE(止损>0,0.8,1,(-1),0),COLORWHITE;
X_11:=BARSLASTCOUNT(止盈>0);
DRAWTEXT(止盈>0,0.5,VAR2STR(X_11,0));
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
X_1赋值:1日前的收盘价
X_2赋值:SMA(收盘价-X_1和0较大值,5,1)/SMA(收盘价-X_1的绝对值,5,1)*100
X_2的5日[1日权重]移动平均
X_4赋值:上次X_2<=15距今天数<5
X_2的5日[1日权重]移动平均
X_6赋值:X_2上穿X_3 AND X_5>15 AND X_4
X_7赋值:X_6的10过滤
X_8赋值:IF(收盘价>REF((6*最高价+5*REF(最高价,1)+4*REF(最高价,2)+3*REF(最高价,3)+2*REF(最高价,4)+1*REF(最高价,5))/(6+5+4+3+2+1),1),1,IF(收盘价[
X_9赋值:上次NOT(X_8=0距今天数)]
X_10:=IF(X_8=0,X_9日前的X_8,X_8)
输出触发:X_7,NODRAW,画红色
输出止损:收盘价[0距今天数) AND COUNT(收盘价][0距今天数),上次X_7>0距今天数)=1 AND IF(收盘价的1日简单移动平均>IF(X_10=(-1),最高价的6日简单移动平均,最低价的6日简单移动平均),1,(-1))>0,NODRAW,画白色]
输出止盈:最高价/REF(收盘价,上次X_7>0距今天数)>=1.05 OR 收盘价/REF(收盘价,上次X_7>0距今天数)>=1.05 AND COUNT(止损,上次X_7>0距今天数)=0 AND COUNT(CROSS(0,IF(收盘价的1日简单移动平均>IF(X_10=(-1),最高价的6日简单移动平均,最低价的6日简单移动平均),1,(-1))),上次X_7>0距今天数)=0,NODRAW, 画蓝色
输出区间:COUNT(X_7,上次X_7距今天数+1)=1 AND COUNT(止损,BARSLAST(X_7>0)+1)=0 AND COUNT(CROSS(0,IF(收盘价的1日简单移动平均>IF(X_10=(-1),最高价的6日简单移动平均,最低价的6日简单移动平均),1,(-1))),BARSLAST(X_7>0)+1)=0,NODRAW,COLOR696960
输出结束:COUNT(X_7,上次X_7距今天数+1)=1 AND COUNT(止损,BARSLAST(X_7>0)+1)=0 AND COUNT(CROSS(0,IF(收盘价的1日简单移动平均>IF(X_10=(-1),最高价的5日简单移动平均,最低价的5日简单移动平均),1,(-1))),BARSLAST(X_7>0)+1)=1 AND CROSS(0,IF(收盘价的1日简单移动平均>IF(X_10=(-1),最高价的6日简单移动平均,最低价的5日简单移动平均),1,(-1))) OR 止损,NODRAW,画绿色
STICKLINE(触发>0,0,1,(-1),0),画红色
当满足条件止盈>0时,在0.4和0.6之间画柱状线
STICKLINE(结束>0,0,0.7,(-1),0),画绿色
STICKLINE(止损>0,0.8,1,(-1),0),画白色
X_11:=BARSLASTCOUNT(止盈>0)
DRAWTEXT(止盈>0,0.5,VAR2STR(X_11,0))