Backtesting results different to forward testing results using regression channel indicator

I have included the regression channel code from the link below in my afl script which I am currently forwarding testing on my IB paper account.
http://www.amibroker.com/kb/2014/10/10/how-to-draw-regression-channel-programatically/
At the end of a trading day, I backtest that day to see how closely my forward testing correlates with backtesting and I am finding no correlation between the backtest and forward testing results.
I understand that this code was built for drawing a regression channel on a chart and I am using it as an indicator to signal entry and exit of positions.
One possible explanation I am trying to determine is whether there may be forward data bias during backtesting by using the regression channel.
I have gone through the knowledge base (http://www.amibroker.com/kb/2014/05/07/why-do-backtest-results-change/) but this does not seem to apply here under these conditions.
I would appreciate it if there is someone who knows why this anomaly exists and could provide an explanation for this as well as whether using this regression channel has the possibility of introducing forward data bias during backtesting.
Many thanks!

@juliev, yes, that regression code of knowledge base isn't a backtesting code. It has LastValue function in there which means you will reference future quotes if being at historical bars.

1 Like

Thanks for the response, codejunkie. Is there a way to prevent this future data bias in the code for backtesting?