Checked the code. It seems ok.
Here it is:

function run()
{
set(PARAMETERS);
set(LOGFILE);
assetList("Assets_ALMA.csv");
if(is(INITRUN)) NumCores = -1;
BarPeriod = 10;
LookBack = 250;
StartDate = 20180701;
EndDate = 20181231;
// NumWFOCycles = -10;

while(loop(Assets))
{
asset(Loop1);
PIP = 0.01;
PIPCost = 0.01;
Spread = RollLong = RollShort = 0;
var PositionValue = 100000;
int pALMAPeriod = optimize(50,5,250);
var pALMASigma = optimize(6,1,20,1);
var pALMAOffset = optimize(0.85,0.01,1.00);
vars indALMA = series(ALMA(series(price()),pALMAPeriod,pALMASigma,pALMAOffset));
Lots = round(PositionValue/price()/100)*100;
if(valley(indALMA))
{
exitShort();
enterLong();
}
if(peak(indALMA))
{
exitLong();
enterShort();
}
}
}