文华财经赢顺MACD面积公式

(2015-10-02 20:10:10)

注:这个公式是用在欧美外汇上的,欧元当下数值为1.1218左右,绿柱面积和红柱面积值偏小,所以我在面积那里乘了参数1000,如果是用在大盘或者美元指数,显然自己需要调这个参数。
1、柱堆的根数 T (组成这柱堆面积的根数)
2、速度 U (U=柱堆面积/T)
DIF:EMA(CLOSE,12)-EMA(CLOSE,26); 
DEA:EMA(DIF,9); 
MACD:(DIF-DEA)*2,COLORSTICK; 
JC:=DEA-DIF; 
AA:=BARSLAST(JC<0);
BB:=BARSLAST(JC>0);
T:IFELSE(AA>BB,AA,BB),NODRAW;
绿柱面积:1000*IFELSE(MACD<0,SUM(MACD,BARSLAST(JC<0)),0),NODRAW; 
红柱面积:1000*IFELSE(MACD>0,SUM(MACD,BARSLAST(JC>0)),0),NODRAW; 
U:IFELSE(AA>BB,ABS(绿柱面积)/AA,红柱面积/BB),NODRAW;
A1:=IFELSE(MACD<0,LLV(绿柱面积,BARSLAST(JC<0)),0); 
A2:=IFELSE(MACD>0,HHV(红柱面积,BARSLAST(JC>0)),0); 
DRAWNUMBER(CROSS(DEA,DIF),0+1.2/10000,REF(A2,1),2,COLORRED); 
DRAWNUMBER(CROSS(DIF,DEA),0-1.2/10000,REF(A1,1),2,COLORGREEN);
=============================================
最近参考了大智慧的公式,修改了文华的公式。很好用。
/*stktype返回市场类型,如果是外汇市场(文华财经的类型6表示外汇市场),就放大倍数500.
FACTOR :IFELSE(STKTYPE=6,500,1),NODRAW;
DIF : FACTOR*(EMA(CLOSE,12) - EMA(CLOSE,26));
DEA : EMA(DIF,9);
MACD: 2*(DIF-DEA),COLORSTICK;
绿面积:IF(MACD<0,SUM(MACD,BARSLAST(MACD>0)),0),NODRAW; 
红面积:IF(MACD>0,SUM(MACD,BARSLAST(MACD<0)),0),NODRAW;
DRAWNUMBER(CROSS(DEA,DIF),HHV(MACD,4), REF(红面积,1),2,COLORRED),VALIGN2;
DRAWNUMBER(CROSS(DIF,DEA),LLV(MACD,4), REF(绿面积,1),2,COLORGREEN),VALIGN0;
DRAWNUMBER(BARSTATUS=2 AND MACD>0, -MACD*0.03, 红面积,2, COLORYELLOW),VALIGN0, ALIGN0;
DRAWNUMBER(BARSTATUS=2 AND MACD<=0, -MACD*0.03, 绿面积,2, COLORYELLOW),VALIGN2,ALIGN0;
========
另附

1、际人学长的MACD红绿柱面积公式,用于飞狐

input:调整参数(0.1,0.0001,1000),数字位置(1,1,1000);//{input:默认参数,最小值,最大值}

p:=26;s:=12;m:=9;
DIFF:EMA(c,s) - EMA(c,p);
DEA:EMA(DIFF,m);
MACD:2*(DIFF-DEA),COLORSTICK;
BV:=SUM(MACD/调整参数,0);
BA:=IF(MAX(BV,REF(BV,2))REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMACD:=BV-REF(BV,BC);

涨面积:=FLOOR(SUM(MACD,BARSLAST(MACD<0))/调整参数),linethick0;
跌面积:=FLOOR(ABS(SUM(MACD,BARSLAST(MACD>0)))/调整参数),linethick0;

var3:=if(macd>0,HHV(abs(macd),bc)*数字位置,LLV(macd,bc)*数字位置);
var4:=(macd)/20;{图形比例缩小1/20,可修改}
var5:=SMACD*100;

DRAWNUMBER(CROSS(0,MACD),ref(var3,1),REF(涨面积,1),0),,colorgreen;
DRAWNUMBER(CROSS(MACD,0),ref(var3,1),REF(跌面积,1),0),colorff00ff;
M1:=REF(MACD,1);
STICKLINE(macd>0 and macd<=m1,0,macd,3,0),coloryellow;
STICKLINE(macd<0 and macd>=m1,0,macd,3,0),colorwhite;

jc := dea-diff;
绿柱面积:IF (MACD<0,SUM(MACD,BARSLAST(jc<0))/调整参数,0),linethick0,colorcyan,PRECISION0;
红柱面积:IF (MACD>0,SUM(MACD,BARSLAST(jc>0))/调整参数,0),linethick0,colorred,PRECISION0;

AA1:=IF(MACD>0,1,-1),LINETHICK0;
AA2:=REF(AA1,1),LINETHICK0;
AA3:=AA1*AA2,LINETHICK0;
AA4:=BARSLAST(AA3<0),LINETHICK0;
AA5:=AA4+1,LINETHICK0;
当前面积:SUM(MACD,AA5)/0.10,COLORGREEN,LINETHICK0;

====================
大智慧面积公式
DIF : 10*(EMA(CLOSE,short) - EMA(CLOSE,long));
DEA : EMA(DIF,mid);
MACD : 2*(DIF-DEA), COLORSTICK;
{面积计算}//注:SUM(MACD在N周期内的总和 BARLAST上一次条件成立(macd>0)到当前的周期数;
绿面积:IF (MACD<0,SUM(MACD,BARSLAST(MACD>0)) * 100,0),linethick0,colorgreen;
红面积:IF (MACD>0,SUM(MACD,BARSLAST(MACD<0)) * 100,0),linethick0,colorred;
DRAWTEXT( ref(MACD,1)>0 and MACD<=0 ,HHV(MACD,4), NUMTOSTRN(REF(红面积, 1), 3)), colorred,valign2;
DRAWTEXT( ref(MACD,1)<0 and MACD>=0 ,LLV(MACD,4), NUMTOSTRN(REF(绿面积, 1), 3)), colorgreen;
{当前面积}
DRAWTEXT(BARSTATUS=2 and macd>0, -macd*0.03, NUMTOSTRN(红面积, 1),3), coloryellow,valign0, align2;
DRAWTEXT(BARSTATUS=2 and macd<=0, -macd*0.03, NUMTOSTRN(绿面积, 1),3), coloryellow,valign2,align2;
{多空线: 0, colorwhite, dotline;}
stickline(MACD<0 and MACD>=REF(MACD, 1), 0, macd, 0, 0), linethick2,colorwhite;
stickline(MACD<0 and MACD<</span>REF(MACD, 1), 0, macd, 0, 0),linethick2, colorgreen;
stickline(MACD>=0 and MACD>REF(MACD, 1), 0, macd, 0, 0), linethick2,colorred;
stickline(MACD>=0 and MACD<=REF(MACD, 1), 0, macd, 0, 0),linethick2, colorwhite;
{根据条件变色绘制dif线,当dif向上时画红线,dif向下时画绿线}
partline(dif,dif>=ref(dif,1),rgb(255,0,0),dif﹤ref(dif,1),rgb(0,255,0)),linethick2;
=================
文华均线公式,修改了均线的粗细,
用4条均线,分别为(20,60,144,233)
MA1:MA(CLOSE,N1),COLORMAGENTA,LINETHICK1;
MA2:MA(CLOSE,N2),COLORWHITE,LINETHICK3;
MA3:MA(CLOSE,N3),COLORYELLOW,LINETHICK2;
MA4:MA(CLOSE,N4),LINETHICK1;
MA5:MA(CLOSE,N5),LINETHICK3;
MA6:MA(CLOSE,N6),LINETHICK3;
文华公式函数列表
http://www.360doc.com/content/13/0613/16/334564_292608936.shtml
波段高低点公式:
文华技术人员:
1、系统工具——》个性化设置——》图表常用设置2——》波段高低价比较范围,这个是系统源码不便公布
 
2、您可以通过编写自定义波段高低点
 
AA:=H>REF(HHV(H,N1),1)&&H>REFX(HHV(H,N2),N2);//最高价大于前面N1个周期的最高价并且大于后面N2个周期的最高价定义为波段高点,N1和N2您可以自定义为多少
BB:=L<</span>REF(LLV(L,N1),1)&&L<</span>REFX(LLV(L,N2),N2);
DRAWNUMBER(AA,H,H,2,COLORRED);
DRAWNUMBER(BB,L,L,2,COLORGREEN);
(0)

相关推荐