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 CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
61 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
34 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
198 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
364 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
283 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment