[討論] adaptive macd (a000000bbm)

作者: sbluo (pretty tight)   2015-07-10 15:38:09
原論壇標題: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
作者: a000000bbm (不設立場)   2015-07-10 17:01:00
感動 謝謝你

Links booklink

Contact Us: admin [ a t ] ucptt.com