作者sbluo (股停梁朝痿)
看板Trading
标题[讨论] adaptive macd (a000000bbm)
时间Fri Jul 10 15:38:09 2015
原论坛标题:Improving MACD Indicator
大意:把原内建 MACD 指标内的 EMA 改为 Adaptive Moving Average 就是 Adaptive
Moving Average "MACD"。原内建指标修改的部分改为注解,请自行比较。
Easy Language Code:
{ Forum 110183 }
inputs:
Price( Close ),
FastLength( 12 ),
SlowLength( 26 ),
EffRatioLength( 10 ),
MACDLength( 9 ),
Paint_Level( 0.5 ),
HistThickness( 1 ) ;
variables:
MyMACD( 0 ),
MyAdaptive( 0 ),
MACDAvg( 0 ),
MACDDiff( 0 ) ;
//MyMACD = MACD( Close, FastLength, SlowLength ) ; // comment out
standard MACD calculation
// Change MACD calculation to take the difference between the slow and fast
moving averages
// using Adaptive Moving Averages with the "fast" moving average having half
the
// EffRatioLength as the "slow" moving average
MyMACD = AdaptiveMovAvg( Price, EffRatioLength / 2, FastLength, SlowLength )
- // Fast Adapative
AdaptiveMovAvg( Price, EffRatioLength, FastLength, SlowLength )
; // Slow Adaptive
MACDAvg = XAverage( MyMACD, MACDLength ) ;
MACDDiff = MyMACD - MACDAvg ;
Plot1( MyMACD, "MACD" ) ;
Plot2( MACDAvg, "MACDAvg" ) ;
Plot3( MACDDiff, "MACDDiff", Yellow, 0, 0 ) ;
Plot4( 0, "ZeroLine" ) ;
Plot5( Paint_Level ) ;
Plot6( -Paint_Level ) ;
if MACDDiff > Paint_Level then
Plot3( MACDDiff, "MACDDiff", Green, Default, HistThickness ) ;
if MACDDiff <-Paint_Level then
Plot3( MACDDiff, "MACDDiff", Red, Default, HistThickness ) ;
跑出的图如下:
http://i.imgur.com/aV5mnQf.png
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.230.240.168
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Trading/M.1436513894.A.1DA.html
※ 编辑: sbluo (36.230.240.168), 07/10/2015 15:40:10
1F:推 a000000bbm: 感动 谢谢你 07/10 17:01