I've tried with exactly one BarPeriod = optimize(...).

With no if(is(INITRUN)), Train works but the parameter graph is identical for all values, no matter what optimize settings I've tried (so far).

With the BarPeriod = optimize(...) inside an if(is(INITRUN)), Train gives an error 040, Bar 1:2 - Bar 2:0.

Zorro 1.12.