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 Hwop38, 05-04-2026, 07:02 PM
|
0 responses
164 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
318 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
246 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
350 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
179 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment