STOCKHISTORY is a Microsoft "connected experience": the function does not compute anything locally, it fetches the price history from Microsoft's online service. That is the key to what you are seeing, and it explains why the workbook behaves differently once compiled while the .xlsm works perfectly.
XLS Padlock 2026 can switch Microsoft connected experiences off inside your protected application. When that option is off, the compiled app tells Excel to disable connected experiences that analyse content, and STOCKHISTORY is one of them, so it simply cannot reach the data service any more. Recalculation is not involved, which is why ticking "Perform a workbook recalculation at startup" changed nothing.
So the first thing to check, and...