Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
position closed notification
Collapse
X
-
position closed notification
I am creating a strategy using a managed approach and would like to have an email once the position is closed. I can have the email sent when initiated since I just add it directly after entering a market order but I can't figure out how to tell when the position goes from either long or short to Flat again. It doesn't need to be instant so somewhere within OnBarUpdate would be fine. Any suggestions?Tags: None
-
Hi Tdschulz,
Thank you for posting.
You can use Position.MarketPosition to check what position you are in and send an email for that.
http://www.ninjatrader.com/support/h...l?position.htmCode:if(Position.MarketPosition == MarketPosition.Flat) SendMail(...)
Let me know if I can be of further assistance.Cal H.NinjaTrader Customer Service
-
I assume that you will want only one email sent every time that you go flat?Originally posted by Tdschulz View PostI am creating a strategy using a managed approach and would like to have an email once the position is closed. I can have the email sent when initiated since I just add it directly after entering a market order but I can't figure out how to tell when the position goes from either long or short to Flat again. It doesn't need to be instant so somewhere within OnBarUpdate would be fine. Any suggestions?
You will, of course, have to set emailSent to false when you enter the trade.Code:private bool emailSent = true; //declared outside any event handler //then in OBU: if(Position.MarketPosition == MarketPosition.Flat && !emailSent) { SendMail(...) emailSent = true; }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
149 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
84 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
129 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
125 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
102 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment