Loop over 3 parameters

In a generic mod file I have 3 parameters and I wanna try 5 different values for each one of the parameters (this gives totally 5^3=125 combinations) and save the simulation results so that I easily can get access to them and make Matlab chose the parameter combination that minimizes some target that I have.

What’s the most efficient way to do this in Dynare?

Indeed run Dynare from a loop. You might want to use the “noclearall” option of Dynare so that your enclosing variables are not cleared at every run.