Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
email on position entry
Collapse
X
-
RDPoS, this is definitely possible. You can use the OnPositionUpdate() method to track changes in position to send out emails whenever your position changes. What code are you currently using to send these emails?AustinNinjaTrader Customer Service
-
How about the following?
Code:protected override void OnPositionUpdate(IPosition position) { if (position.MarketPosition == MarketPosition.Long) { SendMail("NT6.5", "[email protected]", "Long position entered", position.AvgPrice); } if (position.MarketPosition == MarketPosition.Flat) { SendMail("NT6.5", "[email protected]", "Position Closed", position.AvgPrice); } }
Comment
-
Hello,
Position.AvgPrice only works on the entry condition.
When you are flat Position.AvgPrice will be 0.
The only way to get the price of the close would be work in OnExecution() and would take some more advanced coding.
You can use this sample to do this:
Let me know if I can be of further assistance.BrettNinjaTrader Product Management
Comment
-
Yes, this is possible. You can work in OnConnectionStatus() method to monitor for disconnections.Ryan M.NinjaTrader Customer Service
Comment
-
The email is still not sent from the previously posted code
Code:protected override void OnPositionUpdate(IPosition position) { if (position.MarketPosition == MarketPosition.Long) { SendMail("NT6.5", "[email protected]", "Long position entered", "Long position entered"); SendMail("NT6.5", "[email protected]", "TEST Long position entered", "Long position entered"); } if (position.MarketPosition == MarketPosition.Flat) { SendMail("NT6.5", "[email protected]", "Position Closed", "Position Closed"); SendMail("NT6.5", "[email protected]", "TEST Position Closed", "Position Closed"); } }
Comment
-
Ok, I updated the info for gmail as per: http://mail.google.com/support/bin/a...n&answer=13287
The following are the Gmail SMTP server and port settings for sending mail through Gmail from any email client program:
under Outgoing mail, set Gmail SMTP server address: smtp.gmail.com
Configure Gmail SMTP user name as: your full Gmail address (including @gmail.com) Google Apps users may have to enter username@your_domain.com
Configure Gmail SMTP password as: Your Gmail password
Configure Gmail SMTP port as: 465 or 587
Configure Gmail SMTP TLS/SSL required as: yes
Obviously there is no SSL setting that I can find.
NT stops responding and crashes. Why?
Last edited by RDPoS; 11-12-2010, 07:15 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
574 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment