I have this simple program and I am trying to get my head around "look-ahead" bias.
The program generates a Buy signal given the rules below, so I have figured out that when the Buy signal is generated, the system buys at the next Open - So, as I understand it, there is no look-ahead bias here.
Where I am confused is at the Sell signal. Here, since TradeDelays( 0, 0, 0, 0 ) is set, the sell signal ( Cross( MA( Close, 20 ), Close ) ) uses the "Close", which in a real-live trading system would not be known. So, does this Sell signal cause "look-ahead" bias?
No, it is not look ahead bias since it is same price as signal occurs -> Close of bar.
But it is just unrealistic/unlikely that you would get trade entry/exit at close of bar in realtime.
Please re-read my post. It is not look ahead bias since it is at same time (-> at bar close). Events at same time are not future leak. But it's just unrealistic in real-time. So a more realistic approach for backtesting is using next bar's prices as trade price.