NexusFi: Find Your Edge


Home Menu

 





Variable strategy order quantity


Discussion in NinjaTrader

Updated
    1. trending_up 2,910 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?
Quantum physics & Trading dynamics
The Elite Circle
Help re translation of ninjascript to EL
NinjaTrader
How to create dashboard like this one?
Platforms and Indicators
Has anyone taken The Confident Trader course from aheadc …
Trading Reviews and Vendors
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
ApexTraderFunding.com experience and review
144 thanks
1 Minute Man
64 thanks
HumbleTraders next chapter
41 thanks
Winning attitudes create winning traders
33 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
25 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


© 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