看板 Trading 關於我們 聯絡資訊
原論壇標題: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://www.ptt.cc/bbs/Trading/M.1436513894.A.1DA.html ※ 編輯: sbluo (36.230.240.168), 07/10/2015 15:40:10
a000000bbm: 感動 謝謝你 07/10 17:01