|
Near the BEuTiFULL Horse Shoe
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184
|
Greetings,
I am trying to automate a backtest for the proper 'mix' of quantity per target for best results in the strategy Analyzer. Basics are:
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:
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 can setup properties, but when I tried to make " BestQuantity = (QPT1 + QPT2 + QPT3);" I have error on compile::
Only assignment, call, increment, decrement, and new object expressions can be used as a statement,CS0201
An assist would be greatly appreciated,
Jon
update:
I managed to have a successful compile, but the logic is flawed
This is from the Strategy Analyzer Settings:
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
|