短期均线不能很好地屏蔽市场的噪声,往往产生虚假的进场信号;长期均线在判断趋势上一般比较准确,但是长期均线有着严重滞后的问题。当价咯沿一个方向快速移动时,短期的移动平均线是最好的。当价咯在横盘的过程中,长期移动平均线是最好的。我们理想中的移动平均线是什么样子的呢?当价咯无目标地移动时,它的反映会比较慢,像长期移动平均线;当价咯有了快速变化的时候,它又能很快地跟上价咯的走势,像短期移动平均线。这样的移动平均线存在吗?当然存在!这就是考夫曼自适应均线(这是从网上找的,接下来的才是本人改编的) DIR2:=ABS(CLOSE-REF(CLOSE,30)); VIR2:=SUM(ABS(CLOSE-REF(CLOSE,1)),30); ER2:=DIR2/VIR2; CS2:=ER2*(0.8-2/24)+2/24; CQ2:=CS2*CS2; AMA2:EMA(DMA(CLOSE,CQ2),2),COLORGREEN,LINETHICK1; 牛熊分界:AMA2,STICK,COLORGRAY; AMA3:IF(AMA2/REF(AMA2,1)>0.997,AMA2,DRAWNULL),COLORBLUE,LINETHICK1; AMA4:IF(AMA2/REF(AMA2,1)>1.001,AMA2,DRAWNULL),COLORRED,LINETHICK1; {K线} {牛熊分界之上阳线} STICKLINE(C>=O AND C>牛熊分界,H,L,0,0),COLORRED; STICKLINE(C>=O AND C>牛熊分界,C,O,2.8,1),COLORRED; {牛熊分界之上阴线} STICKLINE(C<=O AND C>牛熊分界,C,O,2.8,0),COLORRED; STICKLINE(C<=O AND C>牛熊分界,H,L,0,0),COLORRED; {牛熊分界之下阳线} STICKLINE(C>=O AND C<牛熊分界,H,L,0,0),COLORGREEN; STICKLINE(C>=O AND C<牛熊分界,C,O,2.8,1),COLORGREEN; {牛熊分界之下阴线} STICKLINE(C<=O AND C<牛熊分界,H,L,0,0),COLORGREEN; STICKLINE(C<=O AND C<牛熊分界,C,O,2.8,0),COLORGREEN; {写字} XX1:=C>牛熊分界 AND 牛熊分界>REF(牛熊分界,1); DRAWTEXT_FIX(ISLASTBAR AND XX1,0.1,0.01,0,'【牛区持股】'),COLORRED; XX2:=C<牛熊分界 AND 牛熊分界<=REF(牛熊分界,1); DRAWTEXT_FIX(ISLASTBAR AND XX2,0.1,0.01,0,'【熊区观望】'),COLORGREEN; |
