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 8,987 views
    2. thumb_up 11 thanks given
    3. group 7 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread

Email Alerts

  #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?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 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("[email protected]", "[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,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709

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 Twitter 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,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603


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 Twitter 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,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709


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 Twitter 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,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425

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,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709


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 Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on December 20, 2013


© 2024 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 - Privacy Policy - Downloads - Top
no new posts