通达信主力波段主图源码
AF1:=REF(O,1);
AF2:=Abs((REF(C,1)-AF1)/AF1);
AF3:=ABS((REF(H,1)-AF1)/AF1);
AF4:=ABS((REF(L,1)-AF1)/AF1);
BF1:=ABS((AF2+AF3+AF4)/3);
BF2:=O*BF1;
预测低一:=O-BF2;
预测高一:=O+BF2;
今日保护价:=(REF(C,2)+REF(C,1)+O)/3 ,COLOR4080FF,NODRAW;
开盘价1:=OPEN;
开盘价2:=REF(OPEN,1);
最高价1:=HIGH;
最高价2:=REF(HIGH,1);
最低价1:=LOW;
最低价2:=REF(LOW,1);
收盘价1:=CLOSE;
收盘价2:=REF(CLOSE,1);
AAF:=最高价2;
BBF:=最低价2;
CCF:=开盘价2;
DDF:=收盘价2;
EEF:=(AAF+BBF+CCF+2*DDF)/5;
AAAF:=EEF+(AAF-BBF);
BBBF:=2*EEF-BBF;
CCCF:=2*EEF-AAF;
DDDF:=EEF-(AAF-BBF);
上升突破价:=AAAF;
上升阻力价:=BBBF;
下跌支撑价:=CCCF;
下跌反转价:=DDDF;
E:=(HIGH+LOW+OPEN+2*CLOSE)/5;
阻力:=E+(HIGH-LOW);
支撑:=E-(HIGH-LOW);
EEE:=(EEF+上升突破价+上升阻力价+下跌支撑价+下跌反转价)/5;
心理价:=EEE;
FFF:=(EEE+开盘价1)/2;
GGG:=(预测低一+FFF)/2;
预测低二:=MIN(GGG,支撑);
DRAwrECTREL(0,0,360,399,IF(120,RGB(10,0,0),0));
DRAWRECTREL(0,0,360,8,IF(120,RGB(280,0,0),0));
DRAWRECTREL(0,265,360,273,IF(120,RGB(280,0,0),0));
预测高二:=MAX(MA(REF(HIGH,1)/REF(CLOSE,2),27)*REF(CLOSE,1),阻力);
DRAWTEXT_FIX(1,0.18,0.15,0,'测低:'),COLORYELLOW;
DRAWNUMBER_FIX(1,0.24,0.17,0,CONST(预测低二)),COLORCYAN;
DRAWTEXT_FIX(1,0.04,0.15,0,'测高:'),COLORFFFFFF;
DRAWNUMBER_FIX(1,0.10,0.17,0,CONST(预测高二)),COLORYELLOW;
MQ1:=12;
MQ2:=50;
MQ3:=60;
EXP1:=expma(CLOSE,MQ1);
EXP2:=EXPMA(CLOSE,MQ2);
EXP3:=EXPMA(CLOSE,MQ3);
AB:=EMA(((2*C+H+L)/4-LLV(LOW,30))/(HHV(HIGH,30)-LLV(LOW,30))*100,8);
BA:=EMA(AB,5);
A1:=REFDATE(REF(HHV(H,96),5),DATE);
B1:=REFDATE(REF(LLV(L,96),5),DATE);
DY:=((A1)+(B1))/2;
箱顶:=IF(AB>0 AND AB-BA<=0,A1,A1),LINETHICK3,COLOR00FF00;
箱腰:=IF(AB>0 AND AB-BA<=0,DY,DY),LINETHICK3,COLOR00FF00;
箱低:=IF(AB>0 AND AB-BA<=0,B1,B1),LINETHICK3,COLOR00FF00;
高1:=IF(AB>0 AND AB-BA>0,A1,DRAWNULL),LINETHICK3,COLORRED;
中1:=IF(AB>0 AND AB-BA>0,DY,DRAWNULL),LINETHICK3,COLORRED;
低1:=IF(AB>0 AND AB-BA>0,B1,DRAWNULL),LINETHICK3,COLORRED;
顶周期:=TOPRANGE(H);
底周期:=LOWRANGE(L);
上内:=LLVBARS(H,顶周期);
上外:=LLVBARS(L,顶周期);
下内:=HHVBARS(L,底周期);
下外:=HHVBARS(H,底周期);
上力度:=HHV(L,上内+1)>LLV(H,上内+1);
下力度:=HHV(L,下内+1)>LLV(H,下内+1);
上包含:=COUNT(L>=REF(L,1),上外)>2 AND COUNT(H>=REF(H,1),上内)>2;
下包含:=COUNT(H<=REF(H,1),下外)>2 AND COUNT(L<=REF(L,1),下内)>2;
顶0:=顶周期 AND 上力度 AND 上包含 AND 上外>3;
底0:=底周期 AND 下力度 AND 下包含 AND 下外>3;
顶分天数:=BARSLAST(顶0);
底分天数:=BARSLAST(底0);
含中间k线:=IF(顶分天数=0,底分天数,顶分天数)>=3;
顶:=顶0 AND 含中间K线 AND H=HHV(H,BARSLAST(底0));
底:=底0 AND 含中间K线 AND L=LLV(L,BARSLAST(顶0));
NOTEXT上笔划线:DRAWLINE(底,L,顶,H,0),COLORMAGENTA,LINETHICK3;
NOTEXT下笔划线:DRAWLINE(顶,H,底,L,0),COLORLIGREEN,LINETHICK3;
分界点:=NOTEXT上笔划线 AND NOTEXT下笔划线 ;
位置调整:= IF(PERIOD=11,0.02, IF(PERIOD=10,0.02, IF(PERIOD=9,0.02, IF(PERIOD=8,0.001, IF(PERIOD=7,0.02, IF(PERIOD=6,0.01, IF(PERIOD=5,0.005, IF(PERIOD=4,0.002, IF(PERIOD=3,0.001, IF(PERIOD=2,0.001, IF(PERIOD=1,0.0003, IF(PERIOD=0,0.0002,0))))))))))));
DRAWNUMBER(分界点 AND 顶,H+H*位置调整+0.2,H),COLORLIRED;
DRAWNUMBER(分界点 AND 底,L-0.12,L),COLORYELLOW;
STICKLINE(分界点 AND 底,B1,B1+0.2,6,0),COLORMAGENTA;
STICKLINE(分界点 AND 顶,A1,A1-0.2,6,0),COLORGREEN;
买线:=EMA(C,3);
卖线:=EMA(SLOPE(C,21)*20+C,55)*1;
买卖差:=(买线-卖线),COLORYELLOW,NODRAW;
MID:=MA(CLOSE,13);
B3:=MA(C,1);
B4:=SMA(SMA(SMA(B3,2,1),2,1),2,1),COLORYELLOW;
SMA5:=MA(B4,3),COLORYELLOW;
STICKLINE(买卖差>=0 OR B4> SMA5,(买线-买卖差*0.80),MID,2,0),COLORRED;
STICKLINE(买卖差< 0 OR B4<=SMA5,(卖线+买卖差*0.50),MID,2,0),COLORBLUE;
主力线:=3*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1)-2* SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1),3,1),LINETHICK1,POINTDOT;
超短线:=(((主力线-LLV(主力线,21))/(HHV(主力线,21)-LLV(主力线,21)))*(4))*(0.5),COLORYELLOW,LINETHICK3,NODRAW;
金钻趋势:=XMA(XMA(L,25),25)-(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1,LINETHICK2,COLORLIRED;
斜率:=SLOPE(金钻趋势,3)*10,COLORYELLOW,NODRAW;
速率:=10*(斜率-REF(斜率,1)),COLORMAGENTA,NODRAW;
AA1:=crOSS(买卖差,0) AND COUNT(CROSS(买卖差,0) ,10)=1;
AA2:=CROSS(0,买卖差) AND COUNT(CROSS(0,买卖差),10)=1;
FF:=EMA(CLOSE,3);
MA15:=EMA(CLOSE,21);
TYP:=(CLOSE+HIGH+LOW)/3;
cci:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
涨A:=IF(REF(CCI,1)< 100,CCI>120,CCI>100);
涨:=CROSS(FF,MA15) OR FF>=MA15 OR 涨A,COLORRED;
降:=(CROSS(MA15,FF) OR FF< MA15) AND NOT(涨),COLORGREEN;
DRAWTEXT(降 AND COUNT(降,3)=1 ,(B4 + 0.04),'降'),COLOR00FF00;
DRAWTEXT(涨 AND COUNT(涨,5)=1 ,(B4-0.05),'涨'),COLORMAGENTA;
N:=IF(BARSCOUNT(C)>=8,8,BARSCOUNT(C));
AMOV:=vol*(C+L+H)/3;
MN:=SUM(AMOV,N)/SUM(VOL,N),LINETHICK3,COLORYELLOW;
ZA5:=C-MN,NODRAW,COLORCYAN;
VLD:=CROSS(MA(C,13),MA(C,21));
RSS:=(CLOSE-LLV(LOW,15))/(HHV(HIGH,15)-LLV(LOW,15))*100;
K1:=SMA(RSS,10,1);
D1:=SMA(K1,5,1);
KK:=INTPART(K1);
DD:=INTPART(D1);
TFXXS:=KK+DD;
TGLD:=MOD(TFXXS,10);
TGLXS:=(TFXXS-REF(TFXXS,1))*10;
乖离:=TGLXS,LINETHICK1,COLORWHITE,NODRAW;
跌:=(斜率< -0.1 OR 降 OR 速率< 0 OR 乖离< 0) AND ZA5< 0 AND NOTEXT下笔划线 ,COLORCYAN;
Q2:=(CLOSE-LLV(LOW, 18))/(HHV(HIGH, 18)-LLV(LOW, 18))*100;
Q3:=SMA(Q2, 9, 1);
Q4:=SMA(Q3, 3, 1);
长趋势:=3*Q3-2*Q4,COLORRED,LINETHICK3;
趋势线:=EMA(Q3, 3),COLORWHITE,LINETHICK3;
升1:=CROSS(MA(C,5),MA(C,33)) AND MID>REF(MID,1) AND ZA5>0 AND (长趋势>=趋势线 OR 长趋势>=REF(长趋势,1)),NODRAW,COLORRED;
升:=(NOT(跌) OR 涨 OR 升1) AND (ZA5>0.05 ) AND NOTEXT上笔划线 AND 斜率>=0,COLORMAGENTA;
DRAWTEXT(升 AND COUNT(升,5)=1,(B4+0.08),'升'),COLORYELLOW;
DRAWTEXT(跌 AND COUNT(跌 ,3)=1 AND ZA5< -0.05 AND 斜率<=-0.1,(B4 + 0.04),'跌'),COLORWHITE;
VAR200:=(CLOSE-LLV(LOW,20))/(HHV(HIGH,20)-LLV(LOW,20))*100;
VAR300:=SMA(SMA(VAR200,3,1),3,1)/28.57;
VAR400:=EMA(VAR300,5);
操盘:=3*VAR300-2*VAR400;
AW:=CROSS(操盘,VAR300) AND VAR300< 2.1 AND C>O;
MAR3:=MA(C,3);
角度:=ATAN((MAR3/REF(MAR3,1)-1)*100)*180/3.14159>45 ,NODRAW;
RSV2:=(CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100;
K2:=SMA(RSV2,3,1);
D2:=SMA(K2,3,1);
kd金:=K2< 30 AND D2< 30 ;
源码未复制完,下载附件源码
未来函数检测结果如下:
该公式包含未来函数:XMA
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
AF1赋值:1日前的O
AF2赋值:(1日前的C-AF1的绝对值/AF1)
AF3赋值:(1日前的H-AF1的绝对值/AF1)
AF4赋值:(1日前的L-AF1的绝对值/AF1)
BF1赋值:(AF2+AF3+AF4的绝对值/3)
BF2赋值:O*BF1
预测低一赋值:O-BF2
预测高一赋值:O+BF2
今日保护价赋值:(2日前的C+1日前的C+O)/3 ,COLOR4080FF,NODRAW
开盘价1赋值:OPEN
开盘价2赋值:1日前的OPEN
最高价1赋值:最高价
最高价2赋值:1日前的最高价
最低价1赋值:最低价
最低价2赋值:1日前的最低价
收盘价1赋值:CLOSE
收盘价2赋值:1日前的CLOSE
AAF赋值:最高价2
BBF赋值:最低价2
CCF赋值:开盘价2
DDF赋值:收盘价2
EEF赋值:(AAF+BBF+CCF+2*DDF)/5
AAAF赋值:EEF+(AAF-BBF)
BBBF赋值:2*EEF-BBF
CCCF赋值:2*EEF-AAF
DDDF赋值:EEF-(AAF-BBF)
上升突破价赋值:AAAF
上升阻力价赋值:BBBF
下跌支撑价赋值:CCCF
下跌反转价赋值:DDDF
E赋值:(最高价+最低价+OPEN+2*CLOSE)/5
阻力赋值:E+(最高价-最低价)
支撑赋值:E-(最高价-最低价)
EEE赋值:(EEF+上升突破价+上升阻力价+下跌支撑价+下跌反转价)/5
心理价赋值:EEE
FFF赋值:(EEE+开盘价1)/2
GGG赋值:(预测低一+FFF)/2
预测低二赋值:GGG和支撑的较小值
DRAWRECTREL(0,0,360,399,IF(120,RGB(10,0,0),0))
DRAWRECTREL(0,0,360,8,IF(120,RGB(280,0,0),0))
DRAWRECTREL(0,265,360,273,IF(120,RGB(280,0,0),0))
预测高二赋值:MAX(1日前的最高价/2日前的CLOSE的27日简单移动平均*1日前的CLOSE,阻力)
当满足条件1时,在横轴0.18纵轴0.15位置书写文字
DRAWNUMBER_FIX(1,0.24,0.17,0,CONST(预测低二)),COLORCYAN
当满足条件1时,在横轴0.04纵轴0.15位置书写文字
DRAWNUMBER_FIX(1,0.10,0.17,0,CONST(预测高二)),COLORYEL最低价
MQ1赋值:12
MQ2赋值:50
MQ3赋值:60
EXP1:=CLOSE的MQ1日指数移动平均
EXP2:=CLOSE的MQ2日指数移动平均
EXP3:=CLOSE的MQ3日指数移动平均
AB赋值:EMA(((2*C+H+L)/4-30日内最低价最低值)/(30日内最高价最高值-30日内最低价最低值)*100,8)
BA赋值:AB的5日指数移动平均
A1赋值:REFDATE(REF(96日内H最高值,5),DATE)
B1赋值:REFDATE(REF(96日内L最低值,5),DATE)
DY赋值:((A1)+(B1))/2
如果AB>0 AND AB-BA<=0返回A1否则返回A1
如果AB>0 AND AB-BA<=0返回DY否则返回DY
如果AB>0 AND AB-BA<=0返回B1否则返回B1
如果AB>0 AND AB-BA>0返回A1否则返回DRAWNULL
如果AB>0 AND AB-BA>0返回DY否则返回DRAWNULL
如果AB>0 AND AB-BA>0返回B1否则返回DRAWNULL
顶周期赋值:TOPRANGE(H)
底周期赋值:最低价RANGE(L)
上内赋值:LLVBARS(H,顶周期)
上外赋值:LLVBARS(L,顶周期)
下内赋值:HHVBARS(L,底周期)
下外赋值:HHVBARS(H,底周期)
上力度赋值:上内+1日内L最高值>上内+1日内H最低值
下力度赋值:下内+1日内L最高值>下内+1日内H最低值
上包含赋值:COUNT(L>=1日前的L,上外)>2 AND COUNT(H>=1日前的H,上内)>2
下包含赋值:COUNT(H<=1日前的H,下外)>2 AND COUNT(L<=1日前的L,下内)>2
顶0赋值:顶周期 AND 上力度 AND 上包含 AND 上外>3
底0赋值:底周期 AND 下力度 AND 下包含 AND 下外>3
顶分天数赋值:上次顶0距今天数
底分天数赋值:上次底0距今天数
如果顶分天数=0返回底分天数否则返回顶分天数
顶赋值:顶0 AND 含中间K线 AND H=HHV(H,上次底0距今天数)
底赋值:底0 AND 含中间K线 AND L=LLV(L,上次顶0距今天数)
NOTEXT上笔划线:DRAWLINE(底,L,顶,H,0),COLORMAGENTA,LINETHICK3
NOTEXT下笔划线:DRAWLINE(顶,H,底,L,0),COLORLIGREEN,LINETHICK3
分界点赋值:NOTEXT上笔划线 AND NOTEXT下笔划线
位置调整赋值: IF(PERIOD=11,0.02, IF(PERIOD=10,0.02, IF(PERIOD=9,0.02, IF(PERIOD=8,0.001, IF(PERIOD=7,0.02, IF(PERIOD=6,0.01, IF(PERIOD=5,0.005, IF(PERIOD=4,0.002, IF(PERIOD=3,0.001, IF(PERIOD=2,0.001, IF(PERIOD=1,0.0003, IF(PERIOD=0,0.0002,0))))))))))))
DRAWNUMBER(分界点 AND 顶,H+H*位置调整+0.2,H),COLORLIRED
DRAWNUMBER(分界点 AND 底,L-0.12,L),COLORYEL最低价
当满足条件分界点 AND 底时,在B1和B1+0.2之间画柱状线
当满足条件分界点 AND 顶时,在A1和A1-0.2之间画柱状线
买线赋值:C的3日指数移动平均
卖线赋值:EMA(SLOPE(C,21)*20+C,55)*1
买卖差赋值:(买线-卖线),COLORYEL最低价,NODRAW
MID赋值:CLOSE的13日简单移动平均
B3赋值:C的1日简单移动平均
B3的2日[1日权重]移动平均
SMA5赋值:B4的3日简单移动平均,COLORYEL最低价
STICKLINE(买卖差>=0 OR B4> SMA5,(买线-买卖差*0.80),MID,2,0),COLORRED
STICKLINE(买卖差< 0 OR B4<=SMA5,(卖线+买卖差*0.50),MID,2,0),COLORBLUE
主力线赋值:3*SMA((CLOSE-27日内最低价最低值)/(27日内最高价最高值-27日内最低价最低值)*100,5,1)-2* SMA(SMA((CLOSE-27日内最低价最低值)/(27日内最高价最高值-27日内最低价最低值)*100,5,1),3,1),LINETHICK1,POINTDOT
超短线赋值:(((主力线-21日内主力线最低值)/(21日内主力线最高值-21日内主力线最低值))*(4))*(0.5),COLORYEL最低价,LINETHICK3,NODRAW
金钻趋势赋值:XXL的25日简单移动平均,25)-(XXH的25日简单移动平均,25)-XXL的25日简单移动平均,25))*1,LINETHICK2,COLORLIRED
斜率赋值:SLOPE(金钻趋势,3)*10,COLORYEL最低价,NODRAW
速率赋值:10*(斜率-1日前的斜率),COLORMAGENTA,NODRAW
AA1赋值:买卖差上穿0 AND 统计10日满足买卖差上穿0 的天数=1
AA2赋值:0上穿买卖差 AND 统计10日满足0上穿买卖差的天数=1
FF赋值:CLOSE的3日指数移动平均
MA15:=CLOSE的21日指数移动平均
TYP赋值:(CLOSE+最高价+最低价)/3
CCI赋值:(TYP-TYP的14日简单移动平均)/(0.015*AVEDEV(TYP,14))
涨A赋值:IF(1日前的CCI< 100,CCI>120,CCI>100)
涨赋值:FF上穿MA15 OR FF>=MA15 OR 涨A,COLORRED
降赋值:(MA15上穿FF OR FF< MA15) AND NOT(涨),COLORGREEN
DRAWTEXT(降 AND 统计3日满足降的天数=1 ,(B4 + 0.04),'降'),COLOR00FF00
DRAWTEXT(涨 AND 统计5日满足涨的天数=1 ,(B4-0.05),'涨'),COLORMAGENTA
N赋值:IF(C的有效数据周期数>=8,8,C的有效数据周期数)
AMOV赋值:成交量*(C+L+H)/3
MN赋值:N的AMOV日累和/N的成交量日累和,LINETHICK3,COLORYEL最低价
ZA5赋值:C-MN,NODRAW,COLORCYAN
VLD赋值:CROSS(C的13日简单移动平均,C的21日简单移动平均)
RSS赋值:(CLOSE-15日内最低价最低值)/(15日内最高价最高值-15日内最低价最低值)*100
RSS的10日[1日权重]移动平均
K1的5日[1日权重]移动平均
KK赋值:INTPART(K1)
DD赋值:INTPART(D1)
TFXXS赋值:KK+DD
TGLD赋值:MOD(TFXXS,10)
TGLXS赋值:(TFXXS-1日前的TFXXS)*10
乖离赋值:TGLXS,LINETHICK1,COLORWHITE,NODRAW
跌赋值:(斜率< -0.1 OR 降 OR 速率< 0 OR 乖离< 0) AND ZA5< 0 AND NOTEXT下笔划线 ,COLORCYAN
Q2赋值:(CLOSE- 18日内最低价最低值)/( 18日内最高价最高值- 18日内最低价最低值)*100
Q2的 9日[ 1日权重]移动平均
Q3的 3日[ 1日权重]移动平均
长趋势赋值:3*Q3-2*Q4,COLORRED,LINETHICK3
趋势线赋值:Q3的 3日指数移动平均,COLORWHITE,LINETHICK3
升1赋值:CROSS(C的5日简单移动平均,C的33日简单移动平均) AND MID>1日前的MID AND ZA5>0 AND (长趋势>=趋势线 OR 长趋势>=1日前的长趋势),NODRAW,COLORRED
升赋值:(NOT(跌) OR 涨 OR 升1) AND (ZA5>0.05 ) AND NOTEXT上笔划线 AND 斜率>=0,COLORMAGENTA
DRAWTEXT(升 AND 统计5日满足升的天数=1,(B4+0.08),'升'),COLORYEL最低价
DRAWTEXT(跌 AND 统计3日满足跌 的天数=1 AND ZA5< -0.05 AND 斜率<=-0.1,(B4 + 0.04),'跌'),COLORWHITE
VAR200赋值:(CLOSE-20日内最低价最低值)/(20日内最高价最高值-20日内最低价最低值)*100
VAR200的3日[1日权重]移动平均
VAR400赋值:VAR300的5日指数移动平均
操盘赋值:3*VAR300-2*VAR400
AW赋值:操盘上穿VAR300 AND VAR300< 2.1 AND C>O
MAR3赋值:C的3日简单移动平均
角度赋值:ATAN((MAR3/1日前的MAR3-1)*100)*180/3.14159>45 ,NODRAW
RSV2赋值:(CLOSE-27日内最低价最低值)/(27日内最高价最高值-27日内最低价最低值)*100
RSV2的3日[1日权重]移动平均
K2的3日[1日权重]移动平均
KD金赋值:K2< 30 AND D2< 30
源码未复制完,下载附件源码