Targeting second moments

I am wondering whether dynare has any readymade code available for minimising the distance between the model and data moments of a few target variables. As I understand it is impossible to match all the moments of relevant endogenous variables. A pragmatic approach is to target a few key second moments (say volatilities).

Let me give an example. Suppose there are five forcing processes. In principle, I can can target five standard deviations of five key endogenous variables. I can tinker with the standard deviations of the five forcing processes until I get the best possible match between theoretical and data moments of the five key endogenous variables of interest. This can be done in a trial and error fashion or it can be formally done by minimising some distance function.i have not seen any code in dynare doing this distance minimization approach. Any clue?

In Born/Pfeifer (2014) ( we did a simulated method of moments estimation. In principle, you could also adapt the IRF matching code at
I still did not find the time to provide an easier example for this.