![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Aug 2007
Posts: 64
Thanks: 0
Thanked 0 times in 0 posts
|
I run 2 different strategies on about 10 instruments in four different time frames. When I get an email I have to manually scan the instruments to see which one triggered the alert. Is there an easy way to get the strategy to tell me which instrument triggered the alert? Thanks!
|
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2007
Posts: 64
Thanks: 0
Thanked 0 times in 0 posts
|
That is what I am using now to send the email but the message states "Long startegy triggered" I would like it to say long strategy triggered on USDJPY in 30 min time frame for example. Is there a way to get NT to "get the name of the instrument and automatically out it in the email. I am not aware of a way to get sendmail to do this. Thanks!
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Code:
SendMail("support@ninjatrader.com", "customer@winners.com", "Trade Alert", "Long strategy triggered on " + Instrument.MasterInstrument.Name + " in " + Bars.Period.Value + "-" + Bars.Period.Id + " time frame.");
"Long strategy triggered on ER2 in 1-Minute time frame."
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Aug 2007
Posts: 64
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for your help!
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
|
The NinjaTrader documentation people may already have done this, but if not, I'd like to suggest this as a good example to add to the Help under SendMail.
It would be nice to see this example of Josh's there, in addition to the somewhat less complex example that's already there. Also, I know its a matter of personal preference, but I like this alternate, but equivalent format that could be added as well: Code:
SendMail("support@ninjatrader.com", "customer@winners.com", "Trade Alert", String.Format("Long strategy triggered on {0} in {1}-{2} time frame", Instrument.MasterInstrument.Name, Bars.Period.Value, Bars.Period.Id ));
When I first started with NinjaScript, some 8 months ago, I was somewhat lost on all the C# and .net ideosyncracies for a while, and it took me maybe a month to run across this one (String.Format instead of Variable.ToString() which really got tiresome after a while.) When I say I was a little lost, this is in spite of many years of programming in various other languages; I cannot imagine what it must be like for someone who has little or no experience when they're trying to pick up all these useful things that can be done in C#, but I suspect that little things like this might help. I think that adding more verbose and well-commented examples to the Help documentation would probably be a great assistance to any novice C# or NinjaScript programmer. I will try to add additional items to the forum to help on this, too, as they occur to me. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Instrument Alert System | Rollins | Suggestions And Feedback | 4 | 09-23-2007 01:22 PM |
| Alert() | AO76 | Strategy Development | 5 | 05-27-2007 09:21 AM |
| Alert on cross over/under | scjohn | Market Analyzer | 5 | 05-25-2007 07:21 AM |
| IB Give Up customers | oddball | Connecting | 10 | 04-18-2007 06:07 PM |
| Some Session end times give black white page... | nightowl | Charting | 4 | 03-07-2007 02:02 AM |