I'm having issues trying to use the sendmail function : it continiously sends email to my adress until the condition is false..
I would like the script to send one and only one email alert.. can someone have a look at my code ?
Many thanks
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
///
/// </summary>
[Description("")]
public class JeromeSTDEV : Strategy
{
#region Variables
// Wizard generated variables
private bool jeromeStdev = true; // Default setting for JeromeStdev
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossBelow(Close, Indicator1(0.83, 1, 0.83, 1).LowerOutside, 1))
{
Alert("MyAlert0", Priority.High, "Possible Long", "", 360, Color.Salmon, Color.White);
SendMail("[email protected]", "[email protected]", "NT LNG", "NT LNG");
}
// Condition set 2
if (CrossAbove(Close, Indicator1(0.83, 1, 0.83, 1).UpperOutside, 1))
{
Alert("MyAlert1", Priority.High, "S/S", "", 360, Color.LimeGreen, Color.Black);
SendMail("[email protected]", "[email protected]", "NT S/S", "NT S/S");
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public bool JeromeStdev
{
get { return jeromeStdev; }
set { jeromeStdev = value; }
}
#endregion
}
}
Comment