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 CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
51 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
31 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
99 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
177 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
170 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment