#region Using declarations
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.Gui.Chart;
#endregion
// This namespace holds all indicators and is required. Do not change it.
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 MyTemporary : Indicator
{
#region Variables
// Wizard generated variables
private double myInput0 = 0.000; // Default setting for MyInput0
private double myInput1 = 0.000; // Default setting for MyInput1
// 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.Orange), PlotStyle.Line, "Plot0"));
Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Line, "Plot1"));
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.
Plot0.Set(Close[0]);
Plot1.Set(Close[0]);
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot1
{
get { return Values[2]; }
}
[Description("")]
[GridCategory("Parameters")]
public double MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(0.000, value); }
}
[Description("")]
[GridCategory("Parameters")]
public double MyInput1
{
get { return myInput1; }
set { myInput1 = Math.Max(0.000, value); }
}
#endregion
}
}
Comment