adaptive macd (a000000bbm) - 財經
By Frederica
at 2015-07-10T15:38
at 2015-07-10T15:38
Table of Contents
原論壇標題: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
--
大意:把原內建 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
--
Tags:
財經
All Comments
By Harry
at 2015-07-10T18:41
at 2015-07-10T18:41
Related Posts
來討論一下Sinewave指標
By Mary
at 2015-07-06T23:41
at 2015-07-06T23:41
2015/07/06 贏家通通來論壇
By Zora
at 2015-07-06T21:52
at 2015-07-06T21:52
I B api 和下單問題請教
By John
at 2015-07-03T12:33
at 2015-07-03T12:33
中央再保險徵計量策略研究員
By Vanessa
at 2015-07-02T16:43
at 2015-07-02T16:43
關於期交所期貨成交簡檔 RPT資料
By Annie
at 2015-06-30T15:10
at 2015-06-30T15:10