To get you on your way to the more important stuff, the quick and dirty
solution would be to just add the constraints to your Buy logic.
e.g.
Valid = A < B AND B < C AND ...;
Buy = ... AND Valid;
Your optimization will blindly evaluate unnecessary combinations. But, if the
optimization time is not a factor, then this is a foolproof way to get you to
the next step without dickering around with clever coding.
Otherwise, you can try to derive the later values as a function of the earlier
values and reduce the number of optimized variables.
e.g.
b = 3 * a;
Similarly, if you know that you will have enough bars in the optimization
period you could reduce the optimized variables to a single index into
predefined arrays.
Regardless of whether or not you use the elements, predefined arrays can have
at most as many elements as there are bars under study. So, if your range is 3
bars wide, you can only have 3 values in your a,b,c arrays.
e.g.
a[0] = 5; b[0] = 32; c[0] = 123;
...
a[9] = 14; b[9] = 41; c[9] = 132;
i = Optimize("index", 0, 0, 9, 1);
varA = a[index];
varB = b[index];
varC = c[index];
Or, use file operations fopen, fgets, fclose to read the values from file based
on a single optimized variable (e.g. index). This would probably kill
performance though.
Mike
--- In [email protected], "jh2222jh" <jh222...@...> wrote:
>
> Suggestions on how to program the following?
>
> "a must be less than b, which must be less than c, etc."
>
> I'm optimizing a, b, c, and d, but the numerical value of each must be from
> smallest to largest, otherwise the optimization is worthless. Therefore it's
> either true or false, and only optimizes values of the variables that
> maintain the "true" nature of the increasing value of each variable.
>
> Thanks for any suggestions.
>
> J
>