NexusFi: Find Your Edge


Home Menu

 





Variable strategy order quantity


Discussion in NinjaTrader

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




 
 

Variable strategy order quantity

 
Astrogirl
Milan/Italy
 
Posts: 51 since Oct 2013
Thanks Given: 25
Thanks Received: 12

Hello everyone!

The default quantity of my strategy is "1" but, in certain condition, i would change this value in "2".
What follows is the code I am actually using:

 
Code
protected override void OnBarUpdate()
{
                // Change the order quantity value when the profit factor drow down a certain level
                if (Performance.AllTrades.TradesPerformance.ProfitFactor < profit_factor_limit)
         
              {
                  DefaultQuantity = 2;
              }	
}
The matter is that it changes the default quantity of all trades and not only the one which respects the condition set...

Does anyone know why?


Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
What broker to use for trading palladium futures
Commodities
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
About a successful futures trader who didnt know anythin …
Psychology and Money Management
 
 
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623


In your case you don't change the DefaultQuantity. Instead you simply ask for quantity in the EnterLong() or short or any other Order Method.
As in:
 
Code
                            
EnterLong(2
Use the official help guide for reference:
NinjaTrader Version 7


 



Last Updated on October 20, 2013


© 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