NexusFi: Find Your Edge


Home Menu

 





What is the BestQuantity for Targets 1&2&3 = ??


Discussion in NinjaTrader

Updated
    1. trending_up 2,407 views
    2. thumb_up 1 thanks given
    3. group 1 followers
    1. forum 5 posts
    2. attach_file 1 attachments




 
Search this Thread

What is the BestQuantity for Targets 1&2&3 = ??

  #1 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
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

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Futures True Range Report
The Elite Circle
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
ZombieSqueeze
Platforms and Indicators
Build trailing stop for micro index(s)
Psychology and Money Management
 
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,175
Thanks Received: 101,541


I'm having a hard time understanding your post. Perhaps screen shots, or c# code itself is in order.

But, I can tell you that when I design a strategy with multiple targets, I make those additional targets a cumulative total of the targets before them. This is just to make the optimizer make a bit more sense.

Target 1
Target 2 = Target1 + Target2
Target 3 = Target1 + Target2 + Target3

in code its basically
 
Code
                            


t1 
T1ticks
t2 
T1ticks T2ticks
t3 
T1ticks T2ticks T3ticks 
This just makes the optimizer always go in a logical order, like target 3 is not smaller than target 1.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
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


Big Mike View Post
I'm having a hard time understanding your post. Perhaps screen shots, or c# code itself is in order.

But, I can tell you that when I design a strategy with multiple targets, I make those additional targets a cumulative total of the targets before them. This is just to make the optimizer make a bit more sense.

Target 1
Target 2 = Target1 + Target2
Target 3 = Target1 + Target2 + Target3

in code its basically
 
Code
                            


t1 
T1ticks
t2 
T1ticks T2ticks
t3 
T1ticks T2ticks T3ticks 
This just makes the optimizer always go in a logical order, like target 3 is not smaller than target 1.

Mike

Thanks for the input. I am trying to analyse for the best quantity of each target size. The actual size of each target isnt a factor AFAIK in the solution I am looking for. Target sizes in the strategy do progress in size.

Attached a screenshot of the optimizer setup and output showing the optimized # of trades per target add up to (here it is 7+5+1=13) which is more than the limitation set up by the 'QuantitySQ3' of 9, or the Strategy Analyzer optimized amount of 8 . On screen also are the only parts of the code that are actually involved in the 'QuantitySQ3' == the int variables for the quantity for each target and the total quantity allowed by QuantitySQ3.

Input is greatly appreciated!
Jon

Jon

Attached Thumbnails
Click image for larger version

Name:	BestQuantity.setup.png
Views:	158
Size:	253.4 KB
ID:	23954  
Started this thread Reply With Quote
  #5 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
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

NT support suggests that this is too complex for the backtester to complete, and doesnt even suggest it is possible with custom programming. I still have a feeling that a custom optimization type might accomplish the job, so I havent given up ... just have other more urgent code to build ...

IF anyone has thoughts ... someone that sees how useful this might be .. maybe we can build something

Jon

Started this thread Reply With Quote
  #6 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
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


Big Mike View Post

But, I can tell you that when I design a strategy with multiple targets, I make those additional targets a cumulative total of the targets before them. This is just to make the optimizer make a bit more sense.

This just makes the optimizer always go in a logical order, like target 3 is not smaller than target 1.

Mike

Mike,

I always did wonder why you did that progression. For clarification, does this actually make a difference during optimization even if my targets would be in a pregressive order anyway? ... and if yes, in what way.

I am wonder though that 'maybe' the idea of adding quantity values together in some type of subroutine might be a step towards accomplishing the optimization of quantity per profit target I am looking for.

Regards,
Jon

Started this thread Reply With Quote




Last Updated on October 26, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts