The issue is the returns are arithmetic returns. One cannot add or subtract (or do much of any math for that matter) on arithmetic returns.
What are arithmetic returns? It's what we usually think of as 'return' expressed as a percent. The formula is the well known
arithmetic_return = ((value_current - value_previous) / abs(value_previous))
So as an example, if one's portfolio is $100 on 1-1-2008 and $150 on 12-31-2008, the return for that time would be
return_2008 = (150 - 100) / abs(100) which equals .50 or 50%
Nothing surprising I'm sure. Let's pretend the following year we loose $50. One's portfolio is $150 on 12-31-2008 and $100 on 12-31-2009, the return for that time would be
return_2009 = ((100 -150) / abs(150) which equals .33 or 33%
That looks right. Now, what was our return for the total two year time. One's portfolio is $100 on 1-1-2008 and $100 on 12-31-2009, the return for that time would be
return_2008_2009 = ((100 -100) / abs(100) which equals 0%
That makes sense. We ended with what we started so a return of 0%. But, shouldn't that also simply be the sum of the two returns?
return_2008_2009 = return_2008 + return_2009 = .50 + (-.33) = .17 which is 17%
Hmm 17%?, something's not right. Adding (or subtracting) arithmetic returns doesn't work. To add or subtract returns one must use log returns. Here is the formula to get log returns from arithmetic returns and vice versa
log_return = ln(arithmetic_return + 1)
arithmetic_return = exp(log_return) - 1
Let's try adding log returns and see what we get.
log_return_2008_2009 = ln(return_2008+1) + ln(return_2009+1) = .4 + (-4) = 0.0
arithmetic_return_2008_2009 = exp(log_return_2008_2009) - 1 = 1 - 1 = 0%
That looks better! So, to add or subtract returns simply change to log returns, do the math, then convert back to arithmetic returns.
Let's go back to the 2004 to 2009 test in the original post. We want to find the return for 2008. The starting return on 1-1-2008 is 89.82% and on 12-30-2008 it is 175.64%. We just need to subtract the initial return from the final return. However, we know we must convert to log returns first. Let's do that math
log_return_2008 = ln(1.7564+1) - ln(.8982+1) = 1.014 - .641 = .373
arithmetic_return_2008 = exp(.373) - 1 = 46.2 - 1 = 45.2%
So our calculated 2008 arithmetic return is 45.2%. The backtest was 43.05%. They are very close (much closer than the result when subtracting arithmetic returns). However, they should be exact if it is true that the trades are identical. The difference may be rounding. The log functions are very sensitive. Another issue may be dividends. One must hold a stock on the ex-div date to get a dividend credit. If you want to debug the difference it would be helpful if the actual backtests were attached to the post.
Hope that helps.