Thanks jcl. I've been to the manual many times. But that doesn't mean I understand it all!
First, shouldn't the error/result be the same no matter where BarPeriod is set?
As for the example code, this:
function run()
{
set(PARAMETERS);
BarPeriod = optimize(240,60,1440,60);
Stop = 10 * PIP;
Trail = 10 * PIP;
enterLong();
}
gives identical results for all optimize parameters I've tried so far.
This:
function run()
{
set(PARAMETERS);
if(is(INITRUN)) BarPeriod = optimize(240,60,1440,60);
Stop = 10 * PIP;
Trail = 10 * PIP;
enterLong();
}
gives the Error 040.