网友求助:
求各位老师帮忙!
如何做到本次向下的面积小于上一次向下的面积时,指标发出指示,飞狐或者通达信,最好是飞狐用的
就是禅中说缠中 下跌+横盘+下跌时判断盘整背驰
DIFF:EMA(C,12)-EMA(C,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA), COLORSTICK,LINETHICK2;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=IF(CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21),0.2,0);
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK2;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK2;
MA5:=MACD;
BV:=SUM(MA5,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMA5:=(BV-REF(BV,BC))/8,COLORBLUE,LINETHICK2;
面积:SMA5;
T:=BARSLAST(SMA5>0 AND REF(SMA5,1)<0);
T1:=T+REF(T,T+1);
Q:=REF(SMA5,T+1);
Q2:=REF(SMA5,T1+2);
DRAWICON(Q2<Q AND Q<SMA5 AND SMA5<0 AND C<REF(C,T+1) AND REF(C,T+1)<REF(C,T1+2),0,1) ;
解答如下:
C := DEA-DIFF;
绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(JC<0)),0);
红柱面积:=IF(MACD>0,SUM(MACD,BARSLAST(JC>0)),0);
本次最低价:=LLV(L,BARSLAST(JC<0));
本次最高价:=HHV(H,BARSLAST(JC>0));
X1:=IF (MACD<0,BARSLAST(CROSS(DIFF,DEA)),0);
前次绿柱面积:=REF(绿柱面积,X1+1);
前次最低价:=REF(本次最低价,X1+1);
Y1:=IF((绿柱面积<0 AND ABS(绿柱面积)<ABS(前次绿柱面积) ),1,0);
RS1:= MACD<0 AND REF(MACD,1)<0 AND C<前次最低价
AND ABS(绿柱面积)<ABS(前次绿柱面积) AND ABS(MACD)<ABS(REF(MACD,1));
积底背离: IF (CROSS(DIFF,DEA),REF(Y1,1),0)*100,LINETHICK0,COLORYELLOW;
DRAWTEXT(积底背离,-0.1,'积背'),COLOR00FFFF;