Implementing a delay after first SendMail execution, possible? - NinjaTrader Programming | futures io social day trading
futures io futures trading


Implementing a delay after first SendMail execution, possible?
Updated: Views / Replies:2,715 / 13
Created: by raindrop Attachments:1

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 dont 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
 1  
 
Thread Tools Search this Thread
 

Implementing a delay after first SendMail execution, possible?

  #1 (permalink)
Elite Member
USA
 
Futures Experience: Beginner
Platform: NinjaTrader 6.5
 
Posts: 18 since Mar 2010
Thanks: 13 given, 1 received

Implementing a delay after first SendMail execution, possible?

Hi,
I have implmented SendMail in one of the scripts and it works fine but some time it generates too many e-mail messages in a short period of time. I want to limit the number of e-mails that i can get. So i am thinking of a way where after the first email is sent, system would not send an email for next 30 minutes, just like rearm function of 'Alert' command.

I'd appreciate If anyother user of NinjaTrader has any tips about what commands can I use to code such a functionality. Following is my sample script:

{
// Condition set 1
if (EMA(25)[0] > EMA(72)[0])
{
// SendMail(anyone@att.net, "xxx-xxx-xxxx@vtext.com", "Go Long GBP/CHF", "Buy GBP/CHF");
Log("Buy Alert GBP/CHF", LogLevel.Information);
}

Any cues will be helpful.
Thanks.

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)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received


I don't have NT nor any c# editor available at the moment so I can't check it. Treat this more as a pseudo code (which may require some amendments):

 
Code
                            
//in variables section:
private DateTime lastEmailSent;
 
//OnBarUpdate:
// Condition set 1
if (EMA(25)[0] > EMA(72)[0])
{
   if (
DateTime.Now lastEmailSent.AddMinutes(30))
   {
      
SendMail(anyone@att.net"xxx-xxx-xxxx@vtext.com""Go Long GBP/CHF""Buy GBP/CHF");
      
Log("Buy Alert GBP/CHF"LogLevel.Information);
      
lastEmailSent DateTime.Now;
   }



Last edited by gregid; March 16th, 2010 at 12:30 PM.
Reply With Quote
The following user says Thank You to gregid for this post:
 
  #4 (permalink)
Elite Member
USA
 
Futures Experience: Beginner
Platform: NinjaTrader 6.5
 
Posts: 18 since Mar 2010
Thanks: 13 given, 1 received


gregid View Post
I don't have NT nor any c# editor available at the moment so I can't check it. Treat this more as a pseudo code (which may require some amendments):

Thanks for taking your time responding to my message.

I believe Ninja Trader programming instruction set does not recognize the command "lastEmailSent" so I cannot use your solution.

I was thinking of using an integer variable which gets triggered / rearmed 30 minutes after the last 'SendMail' command line is executed. And a 'SendMail' command line is executed only when that integer variable is triggered/rearmed. But I just don't know how to code such instruction. I'd appreciate any help and guidance here.

Raindrop

Reply With Quote
 
  #5 (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,354 given, 83,237 received

Raindrop, if you put

 
Code
                            
private DateTime lastEmailSent
in variables like greg said, it should work fine.

Please post your full code if it is still not working.

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
The following user says Thank You to Big Mike for this post:
 
  #6 (permalink)
Elite Member
USA
 
Futures Experience: Beginner
Platform: NinjaTrader 6.5
 
Posts: 18 since Mar 2010
Thanks: 13 given, 1 received

Alright, I placed the following line in variables section.

 
Code
                            
private DateTime lastEmailSent
But still I received 3 alerts in 10 minutes of time period.

Following is the rest of the code.

 
Code
                            


      
// Condition set 1
            
if (EMA(25)[0] > EMA(72)[0]
                && (
DateTime.Now lastEmailSent.AddMinutes(30))
                )
               
            {
                
SendMail("anyone@att.net""xxx-xxx-xxxx@vtext.com""Go Long GBP/CHF""Buy GBP/CHF");
                
Log("Buy Alert GBP/CHF"LogLevel.Information);
                
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoBreakEven.wav");
            } 
Any idea what am i missing here?

Thanks.

Reply With Quote
 
  #7 (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,354 given, 83,237 received


raindrop View Post
Alright, I placed the following line in variables section.

 
Code
                            
private DateTime lastEmailSent
But still I received 3 alerts in 10 minutes of time period.

Following is the rest of the code.

 
Code
                            

      
// Condition set 1
            
if (EMA(25)[0] > EMA(72)[0]
                && (
DateTime.Now lastEmailSent.AddMinutes(30))
                )
               
            {
                
SendMail("anyone@att.net""xxx-xxx-xxxx@vtext.com""Go Long GBP/CHF""Buy GBP/CHF");
                
Log("Buy Alert GBP/CHF"LogLevel.Information);
                
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoBreakEven.wav");
            } 
Any idea what am i missing here?

Thanks.

I don't see where you updated lastEmailSent when you sent the email. Just add, under Log():

 
Code
                            
lastEmailSent DateTime.Now
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
The following user says Thank You to Big Mike for this post:
 
  #8 (permalink)
Elite Member
USA
 
Futures Experience: Beginner
Platform: NinjaTrader 6.5
 
Posts: 18 since Mar 2010
Thanks: 13 given, 1 received

I have added the line and now it works perfectly. My thanks to gregid & Big Mike.

You guys are so cool.

Reply With Quote
 
  #9 (permalink)
Elite Member
Malchow (Meckl.)
 
Futures Experience: Intermediate
Platform: NinjaTrader, TWS
Favorite Futures: Stocks
 
Posts: 17 since Mar 2011
Thanks: 15 given, 0 received

Hallo Big Mike,

i tested the code in the thread but something is wrong.
Im sending my *.cs file with the use of control.

where is the error?
Thanks for yor help.

Blackburn from Germany

Attached Files
Register to download File Type: cs KahlerEmailWMA0811.cs (3.8 KB, 7 views)
Reply With Quote
 
  #10 (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,354 given, 83,237 received



Blackburn View Post
but something is wrong.

Hi,

You'll need to be more specific.

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

Reply



futures io > > > > > Implementing a delay after first SendMail execution, possible?

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
500 ms delay. How to create one arjfca MultiCharts 1 July 6th, 2011 09:47 AM
Exchange Data Delay Test MXASJ The Elite Circle 51 January 27th, 2011 10:07 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 10:44 PM.

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-16 in 0.12 seconds with 20 queries on phoenix via your IP 54.227.51.103