NexusFi: Find Your Edge


Home Menu

 





Variable strategy order quantity


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
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?


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Ninjatrader users - good CONNECTIONs post and article fr …
NinjaTrader
Daytrading to swingtrading
Traders Hideout
Would a node-based workflow for automated trading be useful?
Traders Hideout
Trump Media to sell instant access to market-moving soci …
Traders Hideout
Thanks Mike. Godspeed.
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Want your NinjaTrader indicator created, free?
5 thanks
Afternoon-close session
1 thanks
Franks Trading Journey
1 thanks
Denied 20K payouts: Alpha Futures
1 thanks
FootPrintV2 Chart for NT8
1 thanks
  #3 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 649 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


Reply With Quote




Last Updated on October 20, 2013


© 2026 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 - Downloads - Top
no new posts