namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
[Description("Enter the description of your new custom indicator here")]
public class ITG : Indicator
{
#region Variables
// Wizard generated variables
private int ma1 = 3; // Default setting for Ma1
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Black), PlotStyle.Line, "Plot0"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot1"));
Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Line, "Plot2"));
Add(new Plot(Color.FromKnownColor(KnownColor.Firebrick), PlotStyle.Line, "Plot3"));
Overlay = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
if (SMA(3)[0]>SMA(3)[1])
{
Plot0.Set(1);
}
else
{
Plot0.Set(0);
}
}
Comment