NexusFi: Find Your Edge


Home Menu

 





Global Stop


Discussion in NinjaTrader

Updated
    1. trending_up 1,812 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?
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
Thursday May 28: GDP + Core PCE + Jobless Claims All at …
Traders Hideout
Hormuz Normalization Collapses to 19.5% -- Iran Regime F …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #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 Moderator
 
Posts: 3,759 since Jun 2009
Thanks Given: 3,828
Thanks Received: 4,648



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