![]() |
|
|||||||
| Miscellaneous Support Miscellaneous support issues. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Mar 2006
Location: Bellingham, WA , USA
Posts: 331
Thanks: 0
Thanked 11 times in 8 posts
|
I am running a strategy which trades pretty often, and to make my testing a little easier, I set up a send mail method to send a message to me containing the realized profits everytime profit changes by +/- a profit variable (right now at a value of $250).
The Send Mail function works when I use this construct: SendMail("name@gmail.com", "phonenumber@vtext.com", " PnL Notice", "Variable") What I get in the message is the word variable, but that tells me that the messaging is working but my conversion to get the variable value doesn't work. I've tried several different ways, but right now this is what I am using: Code:
protected override void Initialize()
{
SendPnL = new StringSeries(this);
}
protected override void OnBarUpdate()
{
Variable0 = Performance.AllTrades.TradesPerformance.Currency.CumProfit;
real_pnl = Variable0;
SendPnL.Set(Variable0.ToString());
// Messaging and Notifications
if (Performance.AllTrades.TradesPerformance.Currency.CumProfit > real_pnl
+ PnL_Check
|| Performance.AllTrades.TradesPerformance.Currency.CumProfit < real_pnl
- PnL_Check)
{
real_pnl =performance.AllTrades.TradesPerformance.Currency.CumProfit;
SendMail("user_name@gmail.com", "phonenumber@vtext.com", " PnL
Notice",Variable0.ToString());
message using, "Variable0.ToString()). But it doesn't work. How do I convert realized profit into a text value I can send to my phone as an e-mail message? Thanks DaveN
Last edited by daven; 08-15-2011 at 03:02 PM.
Reason: Take out personal cell phone info
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi DaveN,
What is not working exactly? What does a simple print show of this? Print(Variable0.ToString());
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Mar 2006
Location: Bellingham, WA , USA
Posts: 331
Thanks: 0
Thanked 11 times in 8 posts
|
That particular statement wouldn't compile, but I put these print statements in the code, and this is what I got:
protected override void OnBarUpdate() { Variable0 = Performance.AllTrades.TradesPerformance.Currency.C umProfit; real_pnl = Variable0; SendPnL.Set(Variable0.ToString()); Print( " Variable0 = " + Variable0); Print(" SendPnL = " + SendPnL[0]); Print(" real_pnl = " + real_pnl); And I got this in the output file, the value of which agrees with my performance statement about the strategy: Variable0 = 24640.7200000003 SendPnL = 24640.7200000003 real_pnl = 24640.7200000003 So from a print standpoint, the data acquisition seems to be working, but when I try to send, it doesn't send, in fact the messages don't even go out. DaveN |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Great the value is working - so we can isolate the issue to SendMail? SendMail() is a real time only method. Is your script returning true for that block on a real time bar?
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Mar 2006
Location: Bellingham, WA , USA
Posts: 331
Thanks: 0
Thanked 11 times in 8 posts
|
Okay, it's working now. I changed the line to:
SendMail("name@gmail.com", "number@vtext.com", " PnL Notice", real_pnl.ToString()); and now I'm gettng a pnl readout on every new bar. I just need to fix the logic so I can trigger it only on a threshold change in PnL. Thanks so much for your help Ryan. DaveN |
|
|
|
![]() |
| Tags |
| convert variable to text, send mail, variable |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Failure to send mail. | marcusplexus | Miscellaneous Support | 12 | 09-21-2011 08:08 AM |
| Can't send mail to Support | michi08 | Miscellaneous Support | 1 | 09-08-2010 11:20 AM |
| Send Mail problems | rightcoast | Miscellaneous Support | 8 | 06-20-2009 06:39 AM |
| Can't Send Mail | b-rock | Miscellaneous Support | 9 | 06-19-2009 06:52 PM |
| send mail | vk2205 | Strategy Development | 1 | 01-03-2009 02:50 PM |