Okay so I am trying to optimize but keep getting same result for each parameter except the best optimal result. How can I go about it?
Check below for screenshots. Here lies the code:



function run()
{
set(LOGFILE);
StartDate = 20160101;
EndDate = 20210101;
BarPeriod = 240;
LookBack = 200;
MaxLong = 1;
MaxShort = 1;

set(PARAMETERS);
vars Close = series(priceClose());
vars Prices = series(price());
var ma_period = optimize(50,10,200,10);

BBands(Prices,50,2,2,MAType_SMA);
vars upperBand = series(rRealUpperBand);
vars lowerBand = series(rRealLowerBand);


if (crossOver(Close, upperBand)) enterLong();
else if (crossUnder(Close, lowerBand)) enterShort();


PlotWidth = 1000;
PlotHeight1 = 300;


}

Attached Files Opt01.PNGOPT02.PNG