Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Setting up Strategy outgoing Email
Collapse
X
-
For those you are looking for the coded script
SendMail(@"[email protected]", @"Subject Meassage here", Convert.ToString(Position.MarketPosition) + " Instrument " + Convert.ToString(Cbi.Instrument.GetInstrument(Inst rument.FullName, true)) + " Position Quantity " + Convert.ToString(Position.Quantity) + " Average Price " + Convert.ToString(Position.AveragePrice) + " Machine ID " + Convert.ToString(Cbi.License.MachineId));
and this is the condition set I used to send the email once per trade
Create a bool in variables " SendEmailONCE = false " , then where your strategy sends an Order to create a position in the "do the following area EnterLong() place the rule as addition action
SendEmailONCE == false;
these condition sets will then send the email for Long or Short positions created
// Set 125
if ((Position.MarketPosition == MarketPosition.Long)
&& (BarsSinceEntryExecution(0, "", 0) > -1)
&& (BarsSinceEntryExecution(0, "", 0) < 1)
&& (SendEmailONCE == false)
// Condition group 1
&& (((Close[0] + (1 * TickSize)) > Position.AveragePrice)
|| ((Close[0] + (-1 * TickSize)) < Position.AveragePrice)))
{
SendMail(@"[email protected]", @"Subject Message here", Convert.ToString(Position.MarketPosition) + " Instrument " + Convert.ToString(Cbi.Instrument.GetInstrument(Inst rument.FullName, true)) + " Position Quantity " + Convert.ToString(Position.Quantity) + " Average Price " + Convert.ToString(Position.AveragePrice) + " Machine ID " + Convert.ToString(Cbi.License.MachineId));
SendEmailONCE = true;
}
// Set 126
if ((Position.MarketPosition == MarketPosition.Short)
&& (BarsSinceEntryExecution(0, "", 0) > -1)
&& (BarsSinceEntryExecution(0, "", 0) < 1)
&& (SendEmailONCE == false)
// Condition group 1
&& (((Close[0] + (1 * TickSize)) > Position.AveragePrice)
|| ((Close[0] + (-1 * TickSize)) < Position.AveragePrice)))
{
SendMail(@"[email protected]", @"Subject Message Here", Convert.ToString(Position.MarketPosition) + " Instrument " + Convert.ToString(Cbi.Instrument.GetInstrument(Inst rument.FullName, true)) + " Position Quantity " + Convert.ToString(Position.Quantity) + " Average Price " + Convert.ToString(Position.AveragePrice) + " Machine ID " + Convert.ToString(Cbi.License.MachineId));
SendEmailONCE = true;
}
Hope this helps someone and saves you some time.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
44 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment