Analysis of the reasons for the discrepancy between the MACD indicator TV and FMZ ((+ handwritten EMA indicator))

Author: The Old Man, Created: 2021-09-24 16:18:35, Updated:

Today, translating the strategy of a TV, using MACD indicators, as opposed to FMZ and TV, the trend is consistent, but there is still a slight difference in specific values.

It is used by: TA.MACD, talin.MACD, and an open source index library in the community. The results of the comparison: the three above are perfectly consistent. However, the MACD of the TV chart on the review page is not consistent.

In order to simplify the analysis of the problem, I've replaced the comparison of MACD with the comparison of EMA. I started to suspect that the EMA algorithm FMZ and TV were not compatible, but that the EMA algorithm FMZ and TV were not compatible.

Reviewed TV's introduction to the EMA algorithm, wrote an EMA indicator algorithm by hand (added at the end) Again, the comparison was found to be consistent with direct use of TA.EMA, with no difference.

Is it the source of the data?

To further simplify the analysis, I changed the parameter of the EMA to 2, shortened the retest range, dragged the graph to the far left, and I wanted to start comparing the EMA value from the first K line, to see when the last one actually started the discrepancy, and then I started comparing the EMA value from the first K line.

When I pulled on the first one, I was surprised to find that the first K-line in the TV and the first K-line in the FMZ were not the same time, the TV had to go one step further, and the first K-line in the FMZ had to go one step further. This means that the EMA is different from the first EMA, and each EMA that comes after that has a certain weight on the previous EMA, and the EMA that comes after that has a certain weight on the previous EMA. It's no wonder that all the data behind it is inconsistent, the analysis ends here, the reason is strange, but it's found.

function whl_ema(src, length) { var arr = []; var sum = 0; var alpha = 2 / (length + 1) for(var i in src){ if(i<length-1) { arr[i] = null; sum += src[i]; }else if(i==length-1){ arr[i] = (sum+src[i])/length; }else{ arr[i] = alpha * src[i] + (1 - alpha) * arr[i-1] } } return arr; }


More

The Old ManToday I used this indicator again in my strategy, and after comparing it, I found that the daily and the TV are almost identical, even completely the same, but the difference at the lower level is very big, and the last attempt, with some harvests.

The Old ManI've got a friend here who says it doesn't matter, it's really a question of needs, if you or your client have a need, for us developers, whether it works or not, you have to get it right.

syueAs long as it's not high frequency, trendy strategies don't have to measure late entry, early entry, and if you're really concerned about these indicators of strategy's fault tolerance, then the indicators are even less relevant.

syueAs long as it's not high frequency, trendy strategies don't have to measure late entry, early entry, and if you're really concerned about these indicators of strategy's fault tolerance, then the indicators are even less relevant.

syueAs long as it's not high frequency, trendy strategies don't have to measure late entry, early entry, and if you're really concerned about these indicators of strategy's fault tolerance, then the indicators are even less relevant.

The Little Dream"The first K-line in TV and the first K-line in FMZ are not the same time" is what? The length of the k-line is not asymmetrical and does not affect the calculation of the indicator, as long as the k-line data is the same.

Light cloudsGood for you.

The Little DreamIf the K-line data is the same, just one more and one less, there should be no big difference.

Light cloudsHugo, is this the reason why FMZ's SuperTrend indicator and TV's K-line time are always late? This problem always affects the delay in ordering or turning over the opportunity.

Light cloudsHugo, dream big, is this the reason why FMZ's SuperTrend indicator and TV's K line time are always late? This problem always affects the delay in the opportunity to sign up or switch.

The Little DreamIf the number of BARs in the K-line data is different, it affects the number of iterative computations. The corresponding BAR data is the same.

The Old ManFor example, the first root in the TV is 12:00, while the first root in the FMZ is 13:00, with one root less. When calculating this, assume the EMA parameter is 2, so that the EMA of the third root K (the second root in the FMZ) is calculated, the EMA in the FMZ is = (C2 + C3) / 2, while the EMA in the TV is = ((C1 + C2) / 2 * 1/3 + C3 * 2 / 3, completely different.