-
Notifications
You must be signed in to change notification settings - Fork 154
Open
Labels
Description
Based on a series of data, to plot the MACD and signal lines, I am doing:
macD := analytics.MACD(closePriceIndicator, 12, 26)
macDSignal := analytics.MACDSignalLine(macD, 9)
Where the above two functions are defined as:
func MACD(indicator techan.Indicator, shortWindow, longWindow int) techan.Indicator {
return techan.NewMACDIndicator(indicator, shortWindow, longWindow)
}
func MACDSignalLine(indicator techan.Indicator, window int) techan.Indicator {
return techan.NewEMAIndicator(indicator, window)
}
However when I plot this, I get two very different lines
To check I wasn't going completely mad, I changed the signal line to use an SMA instead, so my MACDSignalLine function becomes
func MACDSignalLine(indicator techan.Indicator, window int) techan.Indicator {
return techan.NewSimpleMovingAverage(indicator, window) // Create an exponential moving average with a window of 10
}
which plots like
Which suggests that the EMA isn't working correctly for some reason here. Any suggestions as to where Im going wrong would be great, thanks!
Reactions are currently unavailable

