- UID
- 2
- 积分
- 2893117
- 威望
- 1396590 布
- 龙e币
- 1496527 刀
- 在线时间
- 13326 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-26
|
际人学长的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;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|