Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to code to find BestQuantity for Targets 1&2&3 = ??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to code to find BestQuantity for Targets 1&2&3 = ??

    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:

    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

    #2
    Trader.Jon, unfortunately it is not possible to pass in complex conditions to the backtester, like what you've described here.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Austin,

      Thanks for that clarification .... for some reason I didnt think it was any more complex than what a genetic optimizer would do. I guess I'll have to do it manually .... ouch

      TJ

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rbeckmann05, Today, 06:48 PM
      0 responses
      4 views
      0 likes
      Last Post rbeckmann05  
      Started by rhyminkevin, Today, 04:58 PM
      4 responses
      52 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by iceman2018, Today, 05:07 PM
      0 responses
      5 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      8 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Working...
      X