牛熊一目了然 自适应牛熊分界主图
本人依据网上找的考夫曼自适应均线,在实战中不断摸索,确定了适合自己的参数。同时,为了更加清晰显示当前市况,将市况划分为牛区和熊区,牛区持股,熊区观望。均线(牛熊分界)红色代表牛市,绿色代表熊市,蓝色代表震荡市。如此清晰,操作中还会被套吗?所以严格说来,这个指标应该是一个改编的指标,并不完全是原创,但由本人改编成这样的形式,在全网是独此一家的。
操作方法:绿线熊市观望,即使冒头也不动;蓝线震荡市,K线冒头变红进半仓,一旦变成红线加满仓,若又跌破蓝线则半仓止损出场。本金安全是第一位的
源码
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;