Hi MatPed.

Surely you are right, i´ve always avoided to place optimize statements directly in algo scripts, as i tend to do it at a global level. Probably that´s the reason why i couldn´t optimize the average...

I´ve used lots instead of Margin just for simplicity, but it´s good to know that could be another reason why i couldn´t optimize equity curve trading properly.

Anyway, i see a problem with doing it with averages, this is because we add more parameters to the equation, so we unintentionally increase curve fitting.

You can check the first part of the article and see what i mean, i think applying expectancy or kelly factor over the whole data is a good way of avoiding disasters without adding parameters nor bias. The rolling versions work in a similar way like doing it with averages.

There is people who even just stop trading when they reach MDD95 from Montecarlo.

Thanks.