均线分笔动能公式 可以近似判断缠论背驰情况
思路:以均线相交的情况作为分笔顶点的依据。(是否有道理,还需检验!)
同时以价格乘以时间间隔的开方作为动能。以此作为依据,与前笔比较判定是否背驰。有背驰为细线,无背驰为粗线。
源码
MD6:MA(C,3);
MD5:MA(C,8);
MD4:MA(C,21);
MD3:MA(C,55);
MD2:MA(C,144);
MD1:MA(C,377);
L1:=IF(MD2>=MD1,1,0);
L2:=IF(MD3>MD2 OR MD3=MD2 AND L1=0,1,0);
L3:=IF(MD4>MD3 OR MD4=MD3 AND L2=0,1,0);
L4:=IF(MD5>MD4 OR MD5=MD4 AND L3=0,1,0);
L5:=IF(MD6>MD5 OR MD6=MD5 AND L4=0,1,0);
L6:=IF(C>MD6 OR C=MD6 AND L5=0,1,0);
LL1:=L1+L2*2+L3*4;
LL2:=L4+L5*2+L6*4;
GG:=IF(LL2=7 OR LL2=3,H,0.5*L);
GD:=IF(LL2=0 OR LL2=4,L,1.5*H);
均线顶0:=(LL2=7 OR LL2=3 AND (REF(LL2,1)=7 OR REF(LL2,1)=3) AND (H>REF(H,1) )) ;
均线底0:=(LL2=0 OR LL2=4 AND (REF(LL2,1)=0 OR REF(LL2,1)=4) AND (L<REF(L,1))) ;
GG2:=IF(均线顶0,H,0.9*H);
GD2:=IF(均线底0,L,1.1*L);
均线顶A:=FILTERX(均线顶0 AND GG2=HHV(GG2,BARSLAST(均线底0)),BARSLAST(均线底0));
均线底A:=FILTERX(均线底0 AND GD2=LLV(GD2,BARSLAST(均线顶0)),BARSLAST(均线顶0));
修正顶:=均线顶A;
修正底:=均线底A;
最后底:=filterx(修正底,100000);
x1:=if(修正底,barslast(修正顶),if(修正顶,barslast(修正底),0));
erea:=if(修正底,sqrt(x1)*(ref(h,x1)-l),if(修正顶,(h-ref(l,x1))*sqrt(x1),0));
y1:=ref(x1,x1)+x1;
erea2:=ref(erea,y1);
v1:=if(修正底 or 修正顶, sum(v,x1)/10000,0);
v2:=ref(v1,y1);
e2:=ref(erea,y1);
vv1:=v2/e2*erea;
drawnumber(修正底 ,l*0.97,v1,2),coloryellow;
drawnumber(修正底 ,l*0.98,erea,2),colorred;
drawnumber(修正底 ,l*0.99,l,2),colorgreen;
drawnumber(最后底 ,l*0.96,vv1,2),COLORMAGENTA;
drawnumber( 修正顶,h*1.03,v1,2),coloryellow;
drawnumber( 修正顶,h*1.02,erea,2),colorred;
drawnumber( 修正顶,h*1.01,h,2),COLORMAGENTA;
DRAWLINE(修正底,LOW,修正顶 and erea > erea2, HIGH,0),COLORMAGENTA,LINETHICK3;
DRAWLINE(修正底,LOW,修正顶 and erea <= erea2 , HIGH,0),COLORMAGENTA,LINETHICK1;
DRAWLINE(修正顶,HIGH,修正底 and erea > erea2 , LOW,0),COLORGREEN,LINETHICK3;
DRAWLINE(修正顶,HIGH,修正底 and erea <= erea2 , LOW,0),COLORGREEN,LINETHICK1;