1. 4 targets (PT1, PT2, PT3, PT4)
2. PT4 == runner so quantity is 1
3. QuantityPT1 + QuantityPT2 + QuantityPT3 <= 9
So in the optimizer I have a variable (BestQuantity) I can set to between 3 >> 9, that would interact with the values selected in the optimizer for the QPT1, QPT2, QPT3 ... ie:
Quantity BestQuantity 5;9;1
Quantity ProfitTarget1 0;9;1
Quantity ProfitTarget2 0;9;1
Quantity ProfitTarget3 0;9;1
Quantity ProfitTarget4 1;1;1
So ... if at a point the optimizer has BestQuantity =9 and also selected 7 for QPT1, then it has to select QPT2 + QPT3 == total of 2 in whatever 'mix' and so on to allow the optimizer to select the best result for whatever the # of times the ProfitTargets happen to be filled.
I managed to have a successful compile, but the logic is flawed
This is from the Strategy Analyzer Settings:
Quantity BestQuantity 16 (3;9;1),
Quantity ProfitTarget 1 4 (3;7;1),
Quantity ProfitTarget 2 6 (0;6;1),
Quantity ProfitTarget 3 6 (0;6;1),
Quantity ProfitTarget 4 1
As you can see, the 'BestQuantity' optimized result is the addition of the maximum values selected for optimization (6+6+4 = 16), instead of the 9 intended.
Code used was in 'Initialize' :: BestQuantity = QPT1 + QPT2 + QPT3 ..
BestQuantity and the QPTs are int variables
An assist would be greatly appreciated,
Jon
Comment