Identifying Ranges for Optimization Variables

It would be useful to be able to identify the ranges for optimization variables in order to control decisions made in AFL during backtests.

For example, if x = optimize(“Allocation_1”,5,5,100,5), it would be useful to be able in AFL to identify that the lowest value for x is 5 and the highest value is 100.

I’ve been unable to find any way to do this in AmiBroker Help or this forum.

Is this possible, and if so, how?


How about doing something like this:

minX = 5;
maxX = 100;
x = optimize("Allocation_1", 5, minX, maxX, 5);

Now you can use minX and maxX throughout your code.


1 Like

Matt, thanks for your suggestion.

Yes, that will work, but I was hoping for something a bit more direct and elegant so that I wouldn’t have to set up two new variables for every optimization variable.

Maybe functions like optvar(x,“low”) and optvar(x,“high”).


I don’t see how that is more elegant that what mradtke provided. This is the exact purpose of variables.

1 Like