通达信MA20偏离度主图/副图 跟踪趋势的好指标 源码 附图

{AMA20偏离度源码如下}
EF20:=ABS(C-REF(C,20))/SUM(ABS(C-REF(C,1)),20)*(2/(2+1)-2/(30+1))+2/(30+1);
AMA20:=EMA(DMA(C,EF20*EF20),2);

偏离度:EMA((C-AMA20)/AMA20*100,3);
STICKLINE(C>0,0,0,1,0);


{AMA20主图源码如下}

{AMA 参数:T=1,100,20}
EF20:=ABS(C-REF(C,20))/SUM(ABS(C-REF(C,1)),20)*(2/(2+1)-2/(30+1))+2/(30+1);
KAMA:=EMA(DMA(C,EF20*EF20),2);


{红K}
STICKLINE(C>=KAMA AND C>O,O,C,-1,1),COLOR0000DD; {红色空心柱}
STICKLINE(C>=KAMA AND C>O,H,C,0,0),COLOR0000DD;
STICKLINE(C>=KAMA AND C>O,O,L,0,0),COLOR0000DD;
STICKLINE(C>=KAMA AND C<=O,O,C,-1,0),COLOR0000DD;{红色实心柱}
STICKLINE(C>=KAMA AND C<=O,H,O,0,0),COLOR0000DD;
STICKLINE(C>=KAMA AND C<=O,C,L,0,0),COLOR0000DD;
{蓝K}
STICKLINE(C<KAMA AND C>O,O,C,-1,1),COLORFFBB00; {蓝色空心柱}
STICKLINE(C<KAMA AND C>O,H,C,0,0),COLORFFBB00;
STICKLINE(C<KAMA AND C>O,O,L,0,0),COLORFFBB00;
STICKLINE(C<KAMA AND C<=O,O,C,-1,0),COLORFFBB00;{蓝色实心柱}
STICKLINE(C<KAMA AND C<=O,H,O,0,0),COLORFFBB00;
STICKLINE(C<KAMA AND C<=O,C,L,0,0),COLORFFBB00;

AMA20:KAMA,COLORFFAA00;
UP:IF(AMA20>REF(AMA20,1),AMA20,DRAWNULL),COLORRED,LINETHICK1;

{---------------------------------------------------}

{ATR止盈}
MTR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=SMA(MTR,20,1);
NH20:HHV(H,20),NODRAW;
止盈位:NH20-2*ATR,NODRAW;
{STICKLINE(ISLASTBAR,止盈位,止盈位,20,1),COLORWHITE;
DRAWTEXT(ISLASTBAR,止盈位*1.03,'止盈');}

{在20日最高价处出标注数字、画红点}
TB:=HHV(H,20);
TBT:=HHVBARS(H,20);
T60:=BARSLAST(CURRBARSCOUNT=CONST(TBT)+1);
HH20:DRAWLINE(T60=0,HIGH,ISLASTBAR,REF(HIGH,TBT),0),DOTLINE,COLORYELLOW;{水平线}
{DRAWLINE(T60=0,H,T60=4,REF(H,4),0),COLORGREEN;}{短水平线}
DRAWNUMBER(T60=0,H,H),COLORYELLOW,DRAWABOVE;
●:IF(T60=0,H,DRAWNULL),POINTDOT,COLORRED,LINETHICK4;{红点};


{ATR跟踪止损}
{MTR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));}
MTR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW))/REF(C,1)*100;
日振幅:=ABS(H-L)/REF(C,1)*100,NODRAW;
{日涨幅:(C-REF(C,1))/REF(C,1)*100,NODRAW;}
ATR20:SMA(MTR,20,1),NODRAW;
ATR20幅度:=SMA(MTR1,20,1),NODRAW;
AMA20乖离:(O-AMA20)/AMA20*100,NODRAW;

{均线抵扣}
MA5抵扣:REF(CLOSE,5),COLORFFFF00,NODRAW;
MA20抵扣:REF(CLOSE,20),COLORFFBB00,NODRAW;

{效率系数}
{DIR:=ABS(CLOSE-REF(CLOSE,20));
VIR:=SUM(ABS(CLOSE-REF(CLOSE,1)),20);
效率系数:SUM(ABS(DIR/VIR),1),NODRAW;}

{垂直线}
K5:=FILTER(BACKSET(MA(CLOSE,5) AND ISLASTBAR,5),5);
K20:=FILTER(BACKSET(MA(CLOSE,20) AND ISLASTBAR,20),20);
STICKLINE(K5=1,H+(H-L),L-(H-L),0,-1),COLORYELLOW;
STICKLINE(K20=1,H+1.5*(H-L),L-1.2*(H-L),0,-1),COLORYELLOW;






未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  股票指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股票指标网别名指标网仅为互联网文章,所有股票指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。股票指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图