No problem if not...
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Daily loss limit (account stop limit)
Collapse
X
-
Daily loss limit (account stop limit)
Is it possible to set a daily loss limit for an account in Ninja? I'm thinking if in case a limit order gets filled accidentally, or something goes wrong, that Ninja can flatten an account or suggest doing so, perhaps sending an email, anything like this to protect account blowing up.
No problem if not...Tags: None
-
Hello Crimsonite,
Thank you for your post.
Using the methods and properties Performance, Trade class and TradeCollection class you can create a filter to stop a strategy based on performance of the strategy.
For a reference on stopping a strategy after consecutive losers please visit the following link: http://www.ninjatrader.com/support/f...ad.php?t=19289
Please let me know if I may be of further assistance.
-
The strategy found by downloading the zip file(s) will handle not initiating new trades from best I can tell. But what if we are running several strategies simultaneously and want to monitor an overall, net, PnL for the account.
Is it possible to utilize code within OnBarUpdate and/or OnMarketData for both a REALIZED and UNREALIZED PnL across all strategies...and if the net result is say, over $1000 net for the day; flatten everything?
This of course would exit all positions and render all strategies disabled.
Any ideas?
Thanks.
Brian
Comment
-
Hello brirob14,
Thank you for your note.
You could call NinjaTrader.Gui.SuperDom.SuperDom.FlattenEverythin g(); to flatten everything on the account.
To pull the account values you would need to utilize the code below:
Code:foreach (Account acct in Cbi.Globals.Accounts) { if (acct.Positions != null) { PositionCollection positions = acct.Positions; foreach (Position pos in positions) { Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice); } }
Comment
-
A little example of what I did for that situation:
Code:if ( (Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit> stopdailyamount && stopdaily==true) || (Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit<-stopdailyamount && stopdaily==true)) { ExitLong(); ExitShort(); SendMail ("[email protected]", "[email protected]", "DAILY P/L LIMIT REACHED ", Position.MarketPosition.ToString() + " " + Position.Quantity.ToString() + " PnL " + Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit.ToString("0.00") ); return; }
Where "stopdaily" is a boolean variable that says whether that limit is active or not
I hope this can help youLast edited by pstrusi; 09-24-2015, 02:35 PM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by arvidvanstaey, Today, 02:19 PM
|
3 responses
9 views
0 likes
|
Last Post Today, 03:23 PM | ||
Started by jordanq2, Today, 03:10 PM
|
2 responses
8 views
0 likes
|
Last Post
by jordanq2
Today, 03:23 PM
|
||
Started by traderqz, Today, 12:06 AM
|
10 responses
18 views
0 likes
|
Last Post
by traderqz
Today, 02:49 PM
|
||
Started by algospoke, 04-17-2024, 06:40 PM
|
5 responses
47 views
0 likes
|
Last Post Today, 02:36 PM | ||
Started by mmckinnm, Today, 01:34 PM
|
3 responses
7 views
0 likes
|
Last Post Today, 02:12 PM |
Comment