NexusFi: Find Your Edge


Home Menu

 





Global Stop


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
nourozi
New Zealand
 
Posts: 92 since Jun 2013
Thanks Given: 52
Thanks Received: 30

Hi there,

Is there a way to auto flatten all positions in Ninjatrader once the account reaches a certain amount of drawdown? Preferrably combining unrealized and realized pnl.

For example, my max drawdown is -$800 and I would like to flatten all positions once the realized + unrealized pnl is -$800 or greater.

Thanks,

Erfan.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
AI for Traders — Agents, Memory, Tools & Real-Worl …
Elite Quantitative GenAI/LLM
What we know about Binances $6.3bn hack - BBC News
Cryptocurrency
My Rant with AMP Futures
Trading Reviews and Vendors
[WTS] ATAS Lifetime ULTRA license – EU buyers only – …
Platforms and Indicators
 
  #2 (permalink)
 
sands's Avatar
 sands 
London + UK
 
Experience: Advanced
Platform: Proprietary Analytics
Broker: Multiple broker + Multiple feed
Trading: Currently European and US equities
Posts: 440 since Dec 2013
Thanks Given: 257
Thanks Received: 234

I don't believe that this is possible, however you can programatically exit positions by contract.

Hope that helps.


Reply With Quote
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,779 since Jun 2009
Thanks Given: 3,840
Thanks Received: 4,709



sands View Post
I don't believe that this is possible, however you can programatically exit positions by contract.

Hope that helps.

All is possible in C#, but the question is not clear enough. The answer will be different if it's in a strategy or discretionary.
You can, for example :
- use NinjaTrader.Cbi.Globals.Accounts[].Executions to compute your P&L and unrealized P&L (with an OnPositionUpdate());
- write your last P&L in a flat file, and let a strategy read this file and do what needs to be done;
- read the Ninja database to compute the P&L for the day (or since X hours, ...).


Success requires no deodorant! (Sun Tzu)
Reply With Quote
Thanked by:




Last Updated on March 5, 2014


© 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