If I run the code above, Amibroker will test out ALL possible combinations of the 2 parameters values. In this context, there will be 4x4=16 rows displayed in the optimization test results.
This is not what I want. What I want is to test out each parameter individually. I don't want to test out all possible combinations of the 2 param values. So, there should be 4+4=8 rows displayed in the optimization test results.
What are the combinations you are actually looking for?
I mean if you use two times Optimize() then you will get two columns.
If both columns shall show just 1 to 4 then it is not 8 rows but 4 rows.
So Exclude line would be
Exclude = param1 != param2;
If param1 shall not be same as param2 then
Exclude = param1 == param2;
But this will not get 8 rows but 12.
From your post it does not make much sense to me what you are trying to do.
Both have same range 1 to 4. I guess it is just simple example.
How are they (param1 and param2) used in later code?
Are they used for same indicator?
Do you want to use different ranges for single indicator?
Why not using just one param line (so just one Optimize code line)?
-> So why not using optimize together with matrix (holding periods or whatever param is supposed to be)?
Then you need just single Optimize(). So you get single result column.