NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Charting

Charting Support for NinjaTrader Advanced Charting.

Reply
 
Thread Tools Display Modes
Old 04-20-2012, 08:55 AM   #1
stressless
Junior Member
 
Join Date: Jul 2008
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default Modifying PriceAlert Indicator

I have already modified the PriceAlert Indicator as shown below. This added the SendMail feature to it, which forwards to my phone as an alert. I also want the alert to cancel after the first occurrence so I don't continue getting messages after it triggers. I believe I would use ResetAlert but I haven't gotten the script right. Can someone supply me with the line that I would add below to cancel the alert after it triggers? Thanks


if ((triggerOnGreaterThan && Input[0] >= price - (TickSize * 0.5)) || (!triggerOnGreaterThan && Input[0] <= price + (TickSize * 0.5)))
{
triggered = true;
Alert(DateTime.Now.Millisecond.ToString(), Cbi.Priority.Medium, "Price level '" + price + "' hit!", Cbi.Core.InstallDir + @"\sounds\Alert4.wav", 0, Color.Yellow, Color.Black);
SendMail ("support@ninjatrader.com", "steve@myemail.com", "KOS Buy Alert", "Set Buy Order");
}
stressless is offline  
Reply With Quote
Old 04-20-2012, 09:13 AM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi stressless,

ResetAlert() will make the alert active again. Using a value of 0 for Re-Arm after seconds means that it will only trigger once.

It sounds like you need control mainly on the SendMail() command instead. You can add your own bool variable to this. Best may be a bool input so you could control send mail commands through the indicator properties.

Declare in variables region:
private bool doOnce;

Add as a condition to your SendMail:
Code:
if ((triggerOnGreaterThan && Input[0] >= price - (TickSize * 0.5)) || (!triggerOnGreaterThan && Input[0] <= price + (TickSize * 0.5)))
{
triggered = true;
Alert(DateTime.Now.Millisecond.ToString(), Cbi.Priority.Medium, "Price level '" + price + "' hit!", Cbi.Core.InstallDir + @"\sounds\Alert4.wav", 0, Color.Yellow, Color.Black);

     if(doOnce)
     {
          SendMail ("support@ninjatrader.com", "steve@myemail.com", "KOS Buy Alert", "Set Buy Order");
          doOnce = false;
     }
}
NinjaTrader_RyanM is offline  
Reply With Quote
Old 07-29-2012, 06:12 AM   #3
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Question sendmail with price alert

Hi..

is it possible for someone to modify the price alert indy to include sendmail function?


**how would you code smtpServer info in with the sendmail command? to send email with alert? ...(i do not want the system (MISC/OPTIONS.etc..) to send)

smtp.XXX.com
port587
no ssl
acct username: xyz
acct pw: ~~~
Last edited by mystiq; 07-29-2012 at 01:58 PM. Reason: add info
mystiq is offline  
Reply With Quote
Old 07-29-2012, 06:13 AM   #4
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Default

can you post that modified price alert to the forum with the sendmail command?
mystiq is offline  
Reply With Quote
Old 07-29-2012, 02:00 PM   #5
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Default

Quote:
Originally Posted by NinjaTrader_RyanM View Post
Hi stressless,

ResetAlert() will make the alert active again. Using a value of 0 for Re-Arm after seconds means that it will only trigger once.

It sounds like you need control mainly on the SendMail() command instead. You can add your own bool variable to this. Best may be a bool input so you could control send mail commands through the indicator properties.

Declare in variables region:
private bool doOnce;

Add as a condition to your SendMail:
Code:
if ((triggerOnGreaterThan && Input[0] >= price - (TickSize * 0.5)) || (!triggerOnGreaterThan && Input[0] <= price + (TickSize * 0.5)))
{
triggered = true;
Alert(DateTime.Now.Millisecond.ToString(), Cbi.Priority.Medium, "Price level '" + price + "' hit!", Cbi.Core.InstallDir + @"\sounds\Alert4.wav", 0, Color.Yellow, Color.Black);

     if(doOnce)
     {
          SendMail ("support@ninjatrader.com", "steve@myemail.com", "KOS Buy Alert", "Set Buy Order");
          doOnce = false;
     }
}
is this the only code needed to rcv emails? using sendmail() with priceAlert?

what if your email settings are at DEFAULT?
mystiq is offline  
Reply With Quote
Old 07-29-2012, 05:20 PM   #6
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
Default

Hello,

Yes SendMail() is all you need to send emails from the code when a condition is true.

However the email settings it is using would need to be what is set from Tools--> Misc
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-29-2012, 05:51 PM   #7
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Default

thanks but...u miss understand..i am using the default settings...so...is there any extra code needed to show smtpserver;port;acctinfo...etc..?
Last edited by mystiq; 07-29-2012 at 05:52 PM. Reason: add info
mystiq is offline  
Reply With Quote
Old 07-29-2012, 07:45 PM   #8
mystiq
Senior Member
 
Join Date: Apr 2010
Posts: 147
Thanks: 21
Thanked 1 time in 1 post
Default

is ninjatrader_ryan around?
mystiq is offline  
Reply With Quote
Old 07-29-2012, 07:50 PM   #9
sledge
Senior Member
 
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,194
Thanks: 180
Thanked 302 times in 260 posts
Default

Quote:
Originally Posted by mystiq View Post
is ninjatrader_ryan around?

did you set up tools->options ->misc?
sledge is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PriceAlert indicator error JoshDance Charting 5 04-11-2011 10:17 AM
Modifying an indicator alfa123 Indicator Development 1 02-15-2010 06:22 AM
Can anyone help with modifying this indicator? maxreturn Indicator Development 1 07-12-2009 03:50 PM
Modifying Indicator Label Mike Winfrey Indicator Development 1 09-03-2008 08:07 AM
Modifying NinjatraderPriceAction indicator nico_p Indicator Development 1 03-30-2008 01:15 PM


All times are GMT -6. The time now is 01:49 AM.