Alternative to SendMail () - NinjaTrader Programming | futures io social day trading
futures io futures trading


Alternative to SendMail ()
Updated: Views / Replies:1,576 / 4
Created: by pequemec Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Alternative to SendMail ()

  #1 (permalink)
Elite Member
Elche, Spain
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Zen-Fire
Favorite Futures: ES
 
Posts: 14 since Jul 2009
Thanks: 6 given, 1 received

Alternative to SendMail ()

Hello,

I need an alternative to SendMail () in NinjaTrader. Events:

1. I´ve download Mail.dll from Lesnikowski .NET components.
2. I clicked right mouse button in the NinjaScript Editor and selected the NinjaScript menu name "References…"
3. In the "References…" window, button dialog "Add…"
4. I have selected Mail.dll
5. Also I added using declarations:

using Lesnikowski.Client;
using Lesnikowski.Client.IMAP;
using Lesnikowski.Mail;
using Lesnikowski.Mail.Fluent;
using Lesnikowski.Mail.Headers;
using Lesnikowski.Mail.Headers.Constants;

6. The logic of the indicator is as follows:
 
Code
namespace NinjaTrader.Indicator
{
    public class emailer : Indicator
    {	
	#region Variables
        private const string _server = "smtp.gmail.com";
	private const int _port = 465;
        private const string _user = "xxxxxxxx@gmail.com";
        private const string _password = "xxxxxxx";
	private const string _to = "xxxxxxxx@gmail.com";
		
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            Overlay	= true;
        }
	protected override void OnStartUp()
	{
	    Main();
	}
		
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
        //Example:
			if (CurrentBar < 3)
				return;
			
			if (Close[0] > Close[3])
			{
				CandleOutlineColor = Color.Gold;
				BarColor = Color.Gold; 
			}
			else
			{
				CandleOutlineColor = Color.Empty;
				BarColor = Color.Empty;
			}			
	}
			
        static void Main()
			
        {
            // Use builder class to create new email
            MailBuilder builder = new MailBuilder();
            builder.From.Add(new MailBox(_user, "Alice"));
            builder.To.Add(new MailBox(_to, "Bob"));
            builder.Subject = "Test indicator";
            builder.SetTextData("This is plain text message.");

            IMail email = builder.Create();

            // Send the message
            using (Smtp smtp = new Smtp())
            {
                smtp.ConnectSSL(_server, _port);
                smtp.Ehlo();
                smtp.Login(_user, _password);

                smtp.SendMessage(email);

                smtp.Close();
            }
        }	
   }
}
7. No errors in compile mode.
8. The logic run in Visual Studio 2010 but not run in NinjaTrader, error in output window:

Error on calling 'OnStartUp' method for indicator 'emailer': Los controladores AssemblyResolveEvent no pueden devolver ensamblados cargados sólo para reflexión.
more info here Resolver cargas de ensamblado (but I do not understand)

9. Please, anyone can help me or know a better solution?

Thanks in advance.

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,353 given, 83,234 received


I did a quick look at the translation, it seems it might have something to do with a protected assembly since it is mentioning Reflection.

Why use this third party library? Have you looked at System.Net.Mail?

System.Net.Mail Namespace ()

It might also be helpful if you told us why you need an alternative to the built-in SendMail() function.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #4 (permalink)
Elite Member
Elche, Spain
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Zen-Fire
Favorite Futures: ES
 
Posts: 14 since Jul 2009
Thanks: 6 given, 1 received

Thank you very much.

The code above is an example. Maybe I expressed myself badly, I want to program a function "ReceiveMail()" for read the subject of an email and enter the signal in the chart. Mail.dll has this feature but System.Net.Mail not. Another solution?

Best regards.

Reply With Quote
 
  #5 (permalink)
Elite Member
Elche, Spain
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Zen-Fire
Favorite Futures: ES
 
Posts: 14 since Jul 2009
Thanks: 6 given, 1 received

I will consult the creator of Mail.dll

Reply With Quote

Reply



futures io > > > > > Alternative to SendMail ()

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
SendMail() for strategies dsraider NinjaTrader Programming 34 January 17th, 2015 05:03 PM
Implementing a delay after first SendMail execution, possible? raindrop NinjaTrader Programming 13 August 17th, 2011 03:55 PM
Stop Loss/Target & SendMail() dsraider NinjaTrader Programming 4 May 30th, 2010 07:15 AM
Question about sendmail in strategies fiki NinjaTrader Programming 3 June 24th, 2009 02:25 AM


All times are GMT -4. The time now is 06:20 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-15 in 0.09 seconds with 19 queries on phoenix via your IP 107.20.115.174