aidanabolat
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: August 11th, 2023

Look ahead bias in strategy tester

Hi, I just started learning pine script and would like to know if Strategy tester has look-ahead bias or not .
For example in VIX futures 1H chart 1 bar is from 12:00 to 13:00 but for SPY it starts from 12:30 to 13:30. So when I am trading VIX futures and request SPY close price at 13:00 does it send SPY close price of bar (11:30-12:30) or close price of bar(12:30-13:30 which has look ahead bias)
[spy_price = request.security("SPY", "60", close)]

in my long and short conditions I used barstate.isconfirmed function:
[longCondition=condition and barstate.isconfirmed ][/code]

And if it has look-ahead bias. How to fix it ?

Return to “Pine Script Q&A”