I am working on a NK model with deferred compensation, and I need some help with Dynare code. Two of the first order conditions I have include the sum of past/future values, for example

I am not sure how to write down the equation for F3,t in Dynare and whether this would require a loop? I would appreciate any help.

I’m sorry to bother you but I have another issue with the code - I wrote the code with the loop for the sum which generates the attached .mod file. But, I can’t figure out why .mod file does not work - I keep getting NaN for the residuals of static equations. I think the issue could be due to the equations below:

which hold for t=nu onwards, but I do not know how to specify the initial conditions for X^R_t and chi_t for t = 0 to nu? Thank you in advance for your help.