I tested limit orders using the following code. I set Fill=3, meaning the order is filled at the opening price of the next day. I used historical AAPL EOD data. I placed the order on 2025-1-16 with a limit price of Entry = -232.00. I expected the order to be filled at the opening price of 231.86 the next day (17th, as shown in the attached image), but it was actually filled at 231.85 on the 17th, which is 0.01 less than expected. I'm not sure why this is happening. I tested several other dates, and the result was consistently 0.01 less. Any idea?
function run()
{
set(LOGFILE);
StartDate = 20250101;
EndDate = 20250212;
LookBack = 5;
Slippage=0;
Fill = 3;
Spread = 0;
BarPeriod = 1440;
assetList("AssetsSP30");
asset("AAPL");
vars Prices = series(priceC());
Entry = - 232.00 ;
if(year()==2025 && month()==1 && day()==16){
watch("date",year(), month(),day());
enterLong();
}
}