NexusFi: Find Your Edge


Home Menu

 





Email Alerts


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one shodson with 3 posts (8 thanks)
    2. looks_two wh with 1 posts (2 thanks)
    3. looks_3 HarryThompson with 1 posts (0 thanks)
    4. looks_4 ratfink with 1 posts (0 thanks)
    1. trending_up 9,813 views
    2. thumb_up 11 thanks given
    3. group 7 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
HarryThompson
nashville,TN
 
Posts: 3 since Jan 2010
Thanks Given: 0
Thanks Received: 0

Hi,
Has anyone gotten the email alert to work correctly in ninja trader. I have tried a couple DLL's posted but never seemed to get it to send emails when a condition happened. Any thoughts would be appreciated
Thanks


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
$12M Ceasefire Contract Goes Disputed as Bandar Abbas St …
Prediction Markets & Event Contracts
Q1 2026 Shatters All Derivatives Volume Records -- CME H …
Traders Hideout
SEC Chairman Calls for New Golden Age of SEC-CFTC Regula …
Traders Hideout
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
SEC and CFTC Unlock Customer Cross-Margining for Treasur …
Treasury Notes and Bonds
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Hello Im new here
5 thanks
  #2 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512

look at ninjatrader api

if you use dll, you bind correctly?

if condition
SendMail(string from, string to, string subject, string text);
else condition
SendMail(string from, string to, string subject, string text);

works well for me

best regards

ps

// Generates an email message
SendMail("support@ninjatrader.com", "[email protected]", "Trade Alert", "Buy ES");


Causality is the relationship between an event (the cause) and a second event (the effect), where the second event is a consequence of the first.
Reply With Quote
Thanked by:
  #3 (permalink)
surfer
Charkov
 
Posts: 4 since Jan 2010
Thanks Given: 2
Thanks Received: 0



wh View Post
look at ninjatrader api

if you use dll, you bind correctly?

if condition
SendMail(string from, string to, string subject, string text);
else condition
SendMail(string from, string to, string subject, string text);

works well for me

best regards

ps

// Generates an email message
SendMail("[email protected]", "[email protected]", "Trade Alert", "Buy ES");

thanks
I try use it


Reply With Quote
  #4 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,971 since Jun 2009
Thanks Given: 534
Thanks Received: 3,711

This doesn't work for me because my ISP (Cox) requires all email be sent through their own local SMTP server and when I try to configure the SMTP settings in NinjaTrader it still doesn't work. So I implemented my own email method that seems to work for me. First, add this to the top of your strategy/indicator

 
Code
using System.Net.Mail;
Then, anywhere else inside of your class...

 
Code
private void SendMailLocal(string to, string from, string subject, string body, string smtp)
{
    // Don't send emails on historical data      
    if (Historical)
        return;
    
    try
    {
        MailMessage mailMsg = new MailMessage();
        mailMsg.To.Add(to);

        MailAddress mailAddress = new MailAddress(from);
        mailMsg.From = mailAddress;

        mailMsg.Subject = subject;
        mailMsg.Body    = body;

        SmtpClient smtpClient = new SmtpClient(smtp);
        smtpClient.Send(mailMsg);
    }
    catch (Exception ex)
    {
        Print(ex.Message.ToString());
    }
}


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
Kruus
Manchester UK
 
Posts: 1 since Aug 2013
Thanks Given: 3
Thanks Received: 0

Hi

Shodson, tried to use your method to send emails since I also experience problems when setting up through my ISP. When calling the method you describe, what do you use for describing the SMTP client?

And appologies for any daft questions, I am new to both NT and programming.

Reg

Kruus



shodson View Post
This doesn't work for me because my ISP (Cox) requires all email be sent through their own local SMTP server and when I try to configure the SMTP settings in NinjaTrader it still doesn't work. So I implemented my own email method that seems to work for me. First, add this to the top of your strategy/indicator

 
Code
using System.Net.Mail;
Then, anywhere else inside of your class...

 
Code
private void SendMailLocal(string to, string from, string subject, string body, string smtp)
{
    // Don't send emails on historical data      
    if (Historical)
        return;
    
    try
    {
        MailMessage mailMsg = new MailMessage();
        mailMsg.To.Add(to);

        MailAddress mailAddress = new MailAddress(from);
        mailMsg.From = mailAddress;

        mailMsg.Subject = subject;
        mailMsg.Body    = body;

        SmtpClient smtpClient = new SmtpClient(smtp);
        smtpClient.Send(mailMsg);
    }
    catch (Exception ex)
    {
        Print(ex.Message.ToString());
    }
}


Reply With Quote
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


Kruus View Post
Hi

Shodson, tried to use your method to send emails since I also experience problems when setting up through my ISP. When calling the method you describe, what do you use for describing the SMTP client?

And appologies for any daft questions, I am new to both NT and programming.

Reg

Kruus

Just a note that some ISP's will block port 25.

You can use port 587 usually with popular services like Gmail and Yahoo I think.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,971 since Jun 2009
Thanks Given: 534
Thanks Received: 3,711


Kruus View Post
Hi

Shodson, tried to use your method to send emails since I also experience problems when setting up through my ISP. When calling the method you describe, what do you use for describing the SMTP client?

And appologies for any daft questions, I am new to both NT and programming.

Reg

Kruus

The method I posted over three years ago only works if you have access to an open SMTP server you are allowed to send through, which may vary depending on which local area network your Ninjascript is running on.

I have since moved away from this approach and send all of my emails through a Gmail account which can work from any place on the internet.


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,550 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,430

Hi @Kruus, I thought Ninja used to send emails through it's own SMTP server if you just left the fields blank, or have they stopped doing that?

edit: Just did a test off the laptop free licence Ninja using the Options->Misc 'Test..' button and it still works fine with all server fields left blank.

edit2: and do check your spam settings/folders


Travel Well
Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,971 since Jun 2009
Thanks Given: 534
Thanks Received: 3,711


ratfink View Post
Hi @Kruus, I thought Ninja used to send emails through it's own SMTP server if you just left the fields blank, or have they stopped doing that?

edit: Just did a test off the laptop free licence Ninja using the Options->Misc 'Test..' button and it still works fine with all server fields left blank.

edit2: and do check your spam settings/folders

The problem for me was that my ISP (Cox) blocks accessing SMTP servers outside of their network via blocking port 25 in order to prevent spam being originated from their network. This meant that I could never use the built-in way. With a Gmail acct and the aforementioned method it works for me anywhere since I don't know of any ISPs that block Gmail's SMTP port (587)


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on December 20, 2013


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts