文华财经期货软件指标公式源码MACD顶底背离指标.docx
《文华财经期货软件指标公式源码MACD顶底背离指标.docx》由会员分享,可在线阅读,更多相关《文华财经期货软件指标公式源码MACD顶底背离指标.docx(4页珍藏版)》请在冰豆网上搜索。
![文华财经期货软件指标公式源码MACD顶底背离指标.docx](https://file1.bdocx.com/fileroot1/2022-11/17/4720f3f7-58a2-40a0-b25a-23d0b5cd0dcc/4720f3f7-58a2-40a0-b25a-23d0b5cd0dcc1.gif)
文华财经期货软件指标公式源码MACD顶底背离指标
DIFF:
EMA(CLOSE,7)-EMA(CLOSE,19);
DEA:
EMA(DIFF,9);
FILLRGN(DIFF>DEA,DEA,DIFF,RGB(200,50,55));
FILLRGN(DIFF>DEA,DEA,DIFF,RGB(50,100,10));
MACD:
2*(DIFF-DEA),COLORSTICK;
LC:
=REF(CLOSE,1);//前一周期收盘价
RSI1:
=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;//当根K线收盘价与前一周期收盘价做差,在该差值与0之间取最大值,做N1周期移动平均。
收盘价与前一周期收盘价做差值,取该差值的N1周期移动平均值,两平均值之间做比值。
RSI2:
=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;//当根K线收盘价与前一周期收盘价做差,在该差值与0之间取最大值,做N2周期移动平均。
收盘价与前一周期收盘价做差值,取该差值的N2周期移动平均值,两平均值之间做比值。
RSV:
=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;//收盘价与N周期最低值做差,N周期最高值与N周期最低值做差,两差之间做比值。
K:
=SMA(RSV,3,1);//RSV的移动平均值
D:
=SMA(K,3,1);//K的移动平均值
J:
=3*K-2*D;
A1:
=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:
=REF(C,A1+1)>CANDREF(DIFF,A1+1)A2:
=BARSLAST(REF(CROSS(K,D),1));
B2:
=REF(C,A2+1)>CANDREF(K,A2+1)A3:
=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:
=REF(C,A3+1)>CANDREF(RSI1,A3+1)C1:
=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:
=REF(C,C1+1)DIFFANDCROSS(DEA,DIFF);
C2:
=BARSLAST(REF(CROSS(D,K),1));
D2:
=REF(C,C2+1)KANDCROSS(D,K);
C3:
=BARSLAST(REF(CROSS(RSI2,RSI1),1));
D3:
=REF(C,C3+1)RSI1ANDCROSS(RSI2,RSI1);
STICKLINE(B1>0,-0.1,0,1,0),COLORRED;
STICKLINE(B2>0,-0.1,0,1,0),COLORFF00FF;
STICKLINE(B3>0,-0.1,0,1,0),COLORYELLOW;
STICKLINE(D1>0,0.1,0,1,0),COLOR00FF00;
STICKLINE(D2>0,0.1,0,1,0),COLORFFCC66;
STICKLINE(D3>0,0.1,0,1,0),COLORWHITE;
STICKLINE(MACD>REF(MACD,1)ANDMACD>0,0,MACD,0,0),COLORRED;
STICKLINE(MACD<=REF(MACD,1)ANDMACD>0,0,MACD,0,0),COLORYELLOW;
STICKLINE(MACDSTICKLINE(MACD>=REF(MACD,1)ANDMACD<0,0,MACD,0,0),COLORMAGENTA;
STICKLINE(C>0,0,0,50,1),COLORBLUE;
MACD底背:
IF(B1>0,-0.1,0),COLORRED,POINTDOT;
KDJ底背:
IF(B2>0,-0.1,0),COLORFF00FF,POINTDOT;
RSI底背:
IF(B3>0,-0.1,0),COLORYELLOW,POINTDOT;
MACD顶背:
IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;
KDJ顶背:
IF(D2>0,0.1,0),COLORFFCC66,POINTDOT;
RSI顶背:
IF(D3>0,0.1,0),COLORWHITE,POINTDOT;
强:
IF(DIFF>MA(DIFF,2),DIFF,NULL),COLORRED,LINETHICK2;
弱:
IF(DEA>MA(DEA,2),DEA,NULL),COLORMAGENTA,LINETHICK2;
DRAWICON(CROSS(DIFF,DEA),DEA,5);
DRAWICON(CROSS(DEA,DIFF),DEA,27);
A:
=REF(DIFF,1)[REF(DIFF,1);]
B:
=REF(DIFF,1)>REF(DIFF,2)ANDREF(DIFF,2)>REF(DIFF,3)ANDDIFFDRAWICON(A,DIFF,1);
DRAWICON(B,DIFF,2);
STICKLINE1((MACD>0),0,MACD,0.1,0),COLOR0000CC;
STICKLINE1((MACD>0),0,MACD*0.9,0.1,0),COLOR0000EE;
STICKLINE1((MACD>0),0,MACD*0.8,0.1,0),COLOR0011FF;
STICKLINE1((MACD>0),0,MACD*0.7,0.1,0),COLOR0033FF;
STICKLINE1((MACD>0),0,MACD*0.6,0.1,0),COLOR0055FF;
STICKLINE1((MACD>0),0,MACD*0.5,0.1,0),COLOR0077FF;
STICKLINE1((MACD>0),0,MACD*0.4,0.1,0),COLOR0099FF;
STICKLINE1((MACD>0),0,MACD*0.3,0.1,0),COLOR00BBFF;
STICKLINE1((MACD>0),0,MACD*0.2,0.1,0),COLOR00DDFF;
STICKLINE1((MACD>0),0,MACD*0.1,0.1,0),COLOR00FFFF;
STICKLINE1((MACD<0),0,MACD,0.1,0),COLORCC0033;
STICKLINE1((MACD<0),0,MACD*0.9,0.1,0),COLOREE0033;
STICKLINE1((MACD<0),0,MACD*0.8,0.1,0),COLORFF1133;
STICKLINE1((MACD<0),0,MACD*0.7,0.1,0),COLORFF3333;
STICKLINE1((MACD<0),0,MACD*0.6,0.1,0),COLORFF5533;
STICKLINE1((MACD<0),0,MACD*0.5,0.1,0),COLORFF7733;
STICKLINE1((MACD<0),0,MACD*0.4,0.1,0),COLORFF9933;
STICKLINE1((MACD<0),0,MACD*0.3,0.1,0),COLORFFBB33;
STICKLINE1((MACD<0),0,MACD*0.2,0.1,0),COLORFFDD33;
STICKLINE1((MACD<0),0,MACD*0.1,0.1,0),COLORFFFF33;