I understand lookahead bias is pretty common industry knowledge. But I cannot wrap my head around how I am introducing it and could use a nice and easy explanation. Here's my thought process.
I have $N$ data points of OHLC data. Lets say for the sake of argument I pull $t = 1$ to $N$ from a database.
I train a model on the closing price of this instrument to predict the $t + 1$th value. I understand that by doing so I have introduced lookahead bias.
Where I struggle with is - when I go to predict the next time period's close with live data I'm going to
- Pull $N - 1$ data points
- Wait for this current candle to close (for the sake of argument, lets say I get this data as fast as possible)
- Add the new data point to the list of $N -1 $ data points I have pulled from my database
- Predict the $N+1$th data point (the NEXT time periods data point, in other words the now current data point's close)
- Make my trade
I feel like this is what I am doing in the training procedure, assuming that when I train on the $N$ data points, the $N$th data point has closed already.
Could someone take this example and explain to me where I'm making a mistake in my reasoning? I would really appreciate it.
I should be more specific. Assuming I generate a $-1$ or $1$ signal for sell and buy respectively, and I am using a log return series.