@Jonny8 said in Init data gets not recalculated in optstrategy:

pnl = cerebro.broker.get_value() - globalparams["cash"]

Just a note:

I'm not sure it is a good idea to query the info from the original Cerebro instance's broker.

In multi-CPU case the original Cerebro instance's broker is not updated. In single CPU case (as in the code above), although the same broker instance is used for all the optimization parameter permutation runs, the broker state is reset for each permutation. So querying the broker in this case will return the value for the last optimization run.

It is better to rely only on the data gathered by the analyzers.