Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Sending E-mail upon order execution
Collapse
X
-
3+4 is a clear indicator that there is a coding issue in your logic, since email sending works in general. I suggest working the Print() statement for now and finish implementation of your strategy and then you may add SendMail() statements right after the Print() statements (not replace, to see that mails come in sync with the Print() statements).
-
Thx for the response Dierk......hope you guys dont think I am being a pain on this !
In your note, are you suggesting that I have to wait until you fix the coding issue, before I will be able to use this function at all? or that if I use the Print () statement prior to the SendMail () function that should work.....since trying this the morning it doesn't. See below:
if(x == false)
{ Print("BUY BUY BUY");
SendMail("[email protected]", "[email protected]", "BUY BUY BUY", "");
Print("BUY BUY BUY");
x=true;
}.
Also, can I assume that it will be 3-4 weeks before a fix will be in place?
many thx
David
Comment
-
thx.
Current issue is that using a simulated data feed (because it is the w/e), I am unable to send any emails whatsoever from a strategy.....even one that is as simple as: SendMail() with no other code.
I noted this problem last w/e, but it was suggested there was a bug in my code.
This is the possible reason why when testing the snippet below over the w/e, Print() works by itself, but Print(); SendMail() only Prints.
thx for your help.
DG
Comment
-
a) I suppose you have set up your SMTP server at Tools->Options->Misc and tested that sending mails works ok, no?
b) you double checked that the mail address you are using is valid, no?
I just tested simple strategy below on the sim feed (5 tick chart) and it works as expected -> mails are sent as sim (live) data comes in:
Code:protected override void OnBarUpdate() { if (Historical) return; if (CrossAbove(SMA(5), SMA(20), 1)) { Print("EnterLong"); SendMail(..., "EnterLong", "EnterLong"); EnterLong(); } else if (CrossBelow(SMA(5), SMA(20), 1)) { Print("EnterShort"); SendMail(..., "EnterShort", "EnterShort"); EnterShort(); } }
Comment
-
thx for your respons.
I have now resolved why no e-mail has been sent - it was because the 'Exclude weekends' was set to true !!!!
So now I can send copious e-mails simulataneously through the SIM feed.
I am still unable to do this just the once, however, using a filter.
Pls try the following --- it executes the Print() command, but not the SendMail() command. I have been at this now for over two weeks.....I seem to be getting nowhere!
Is it how I set up the private bool expression?
Even if I change it to an int, I get the same result.
privatebool x = false;
#endregion
///<summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
///</summary>
protectedoverridevoid OnBarUpdate()
{
// Condition set 1
if(x == false)
{
Print("BUY");
SendMail("[email protected]", "[email protected]", "BUY", "");
Print("BUY");
}
x=true;
Comment
-
This then is a bug on your strategy code (since SendMail as per my sample works with your SMTP setup). Unfortunately, due to bandwidth reasons, we are unable to provide support down to the level of actual coding/revising strategies. You might consider contacting a NinjaScript consultant: http://www.ninjatrader.com/webnew/pa...injaScript.htm
Thanks for your understanding.
Comment
-
Your example sends numerous emails per order execution.
Hence the need for a filter.
Hence my example in the prior thread below.
I do not understand how if the following prints "BUY" twice but does not send an e-mail means that there is fault in my code........there is nothing in the log either which suggests that it doesn't even attempt to send an e-mai.
Print()
SendMail()
Print()
I will ask you again - pls try what I have done below.
If you get it to work by changing the code then fine I will contact a consultant.
PS I will not give up
thx
David
Comment
-
Ray / Dierk
Thx for your patience & on-going support in trying to resolve this issue.
In the end yesterday I resorted to contacting a NinjaScript consultant.
Best cash I have spent in a long time.
Code delivered in less that 18 hours at a very reasonable price --- with a very positive response.
Should have done this 4 weeks ago............still at least I have an improved understanding of how your code & NT strategies work.
thx
David
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mikestao, Today, 07:53 AM
|
0 responses
1 view
0 likes
|
Last Post
![]()
by mikestao
Today, 07:53 AM
|
||
Started by higher.high, Today, 06:10 AM
|
1 response
14 views
0 likes
|
Last Post
|
||
Started by Mykro, Today, 07:18 AM
|
1 response
17 views
0 likes
|
Last Post
|
||
Started by Triple_M, Today, 07:48 AM
|
0 responses
3 views
0 likes
|
Last Post
![]()
by Triple_M
Today, 07:48 AM
|
||
Started by QuantKey_Bruce, Today, 05:39 AM
|
1 response
9 views
0 likes
|
Last Post
|
Comment