Hello everyone,

I want to implement an occasionally binding constraint in my model, similar to borrowing constraint:

```
m_h <= m * p_h_r * y_h / ex_r
```

Where m is a parameter. Solving the problem I get the following first order condition:

```
delta_e = lambda_bind
```

Where lambda_bind is the non-negative lagrange multiplier of the binding constraint, and delta_e is the difference in exchange rate.

According to this when the constraint is binding, the next period’s exchange rate is raising because e(+1)=e+lambda_bind. This affects only UIP (lines 137-141 in code)

I’ve tried it (lines 137-146 in code) but it doesn’t give logical IRFs as lambda_bind is negative and close to zero. And it doesn’t reach to convergence for some values of shock. Also piecewise linear and linear solutions are on the same lines.

How can I fix this?

I attach the code below.

util_a.mod (6.5 KB)

Thank you so much