I am afraid I need help.
I am attempting to code the MACD indicator from Joe DiNapoli (see attached MSWord document- slightly different from the standard MACD as uses periods which are not integers for the Exponential Moving Averages (he uses 8.3896, 17.5185, etc).
The periods are actually more easily expressed when converted as smoothing factors (the conversion formula being smoothing factor SF is SF = 1 / (Period+1)). I have used the smoothing factors in my code rather than the periods.
NB: I checked the NT forum: there are a couple of threads on DiNapoli but -from the comments- the confidence level that the code provided uses the accurate parameters seems low.
I attach the code I ended up writing.
- The code compiles and plots w/o problem
- But my 2 intermediate exponential moving averages (EMA1 and EMA2) are calculating wrong values and therefore the plot is wrong
- I printed them in the output window and the value seems to increase consistently over time bearing no resemblance with the price action (and EMA1 and EMA2 being moving averages, they should be correlated to the price)
- The values are also vastly different when compared to NT7 default EMA indicator using neighboring integer values of 8 and 17 instead of the exact 8.3896 and 17.5185
- Therefore, I am pretty sure I made an error in my code (I am new to NT and C#)
Would anyone see where I got my code wrong?
Any and all help is appreciated
Many thanks,
Kind Regards
Comment