How to apply Savitzky–Golay filter with backward window?

196 Views Asked by At

I would like to use Savitzky–Golay filter on stock price to calculate derivative order 1 and order 2. The fact is that standard Savitzky–Golay filter relies on a central window for filtering

So If I calculate Savitzky–Golay filter value on realtime data at day d I will need data for d-2, d-1, d, d+1, d+2. Of course I don't know d+1 and d+2 because they are in the futur. That's why I would need Savitzky–Golay filter using a backward window.

Do you know how I can calculate Savitzky–Golay filter for backward window ?

Thank you so much !