Hello everyone,

I am very new to Julia, so I apologise if the question sounds super dumb to you guys.

I am trying to implement a Moving Horizon Estimation algorithm for parameter estimation, which I did in Matlab CasADi.

I need to have a cost function for the differential equation parameter estimation problem, which minimises the difference between data and estimates and minimises variations between consecutive parameter estimates in different time windows.

Right now I am approaching the problem following the example provided in: Getting Started with Optimization-Based ODE Parameter Estimation · DiffEqParamEstim.jl where Lotka-Volterra parameters are simultaneously estimated from synthetic data.

```
# Optimization problem
cost_function = build_loss_objective(prob, Tsit5(), L2Loss(t, measurewindow; data_weight = weight),
Optimization.AutoForwardDiff(),
maxiters = 10000, verbose = true)
optprob = Optimization.OptimizationProblem(cost_function, p0, lb = p_lb, ub = p_ub)
opt_res = solve(optprob, BFGS())
```

My question is: I know I can use a custom loss function, but are there any examples of how to write it properly?

Again, sorry in advance if the question sounds dumb, hope someone can help me out, thanks.