- ago
Assuming standard parameters (12, 26, 9):
- the first bar for MACD plot to begin is bar 26 (index #25) but its plotting from bar 0
- the first bar for MACD Histogram plot to begin is 35 (26+9) but it begins with MACD

Virtually *all* MACD indicators/variations are affected with one/both issues. e.g. while MACDV begins plotting at bar 26 (which is correct) so does the histogram (which is incorrect):


Hope they all get fixed soon.
0
365
6 Replies

Closed

Bookmark

Sort
Cone8
 ( 3.70% )
- ago
#1
We can agree it would be more correct if the plots didn't start from bar 0.

But do not be alarmed. Block Strategies that use MACD assign 26 to the StartIndex, making this merely cosmetic since strategies would ignore these data. The solution for a C# Coded strategy is the same.

Nonetheless, if you're doing a presentation for a big bank and the cosmetic issue is show stopper, just assign Double.NaN to those first values of affected indicators to eliminate the plot.
0
- ago
#2
I do not see it as a problem. As long as there is data for backfill to build the indicators, they can start from bar 0 [when chosen data range is limited]. I prefer how this works in WL8 as a long seed period was often called as a negative experience in previous versions.

But I'd agree that we could make WL's indicator experience more unified and make MACDV start from bar 0, too!
0
- ago
#3
Maybe I'm old fashioned, or just retarded, as I can't wrap my head around how an indicator can begin plotting before the data required for its calculation even exists.
0
Glitch8
 ( 8.31% )
- ago
#4
The reason is the classic MACD is based on Gerald Appel's original work,

https://www.stockmarkettheory.com/uploads/3/4/8/2/34825752/macd_tutorial.pdf

Here is the relevant paragraph:

"One last detail: These formulas are recursive, which means that today’s reading depends on yesterday’s, which does not tell you where to start. A simple approximation is to use the earliest price you have as the earliest exponential moving average reading. Following this procedure introduces a small error, but after a few weeks’ of data that error becomes negligible."

(emphasis added)
0
- ago
#5
QUOTE:
Block Strategies that use MACD assign 26 to the StartIndex, making this merely cosmetic since strategies would ignore these data. The solution for a C# Coded strategy is the same.

I use the indicator.FirstValidIndex to assign StartIndex in all my C# strategies (or assign customIndicator.FirstValidIndex in my own "nested" coded indicators).

Let's at least make sure the MACD.FirstValidIndex is assigned correctly; otherwise, this error is carried down into all the other indicators that depend on (or nested from) the MACD.
0
Glitch8
 ( 8.31% )
- ago
#6
This isn’t an error. The classic MACD is coded per the classic specs. Please read my post above.
1

Closed

Bookmark

Sort