I created a basic indicator to draw lines from the open and have attempted to draw text next to the lines but I am having trouble getting it to compile.
#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 MyCustomIndicator1 : Indicator { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 private Font largeFont = new Font("Arial", 12); //This variable holds the large font // 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(new Pen(Color.Green, 2), PlotStyle.Square, "Up1")); Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Square, "Dn1")); Add(new Plot(new Pen(Color.Green, 2), PlotStyle.Square, "Up2")); Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Square, "Dn2")); Plots[0].Pen.DashStyle = DashStyle.Dash; Plots[1].Pen.DashStyle = DashStyle.Dash; Plots[2].Pen.DashStyle = DashStyle.Dash; Plots[3].Pen.DashStyle = DashStyle.Dash; CalculateOnBarClose = false; Overlay = true; PriceTypeSupported = false; AutoScale = 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. Up1.Set(CurrentDayOHL().CurrentOpen[0] + 200 * TickSize); Dn1.Set(CurrentDayOHL().CurrentOpen[0] - 200 * TickSize); Up2.Set(CurrentDayOHL().CurrentOpen[0] + 300 * TickSize); Dn2.Set(CurrentDayOHL().CurrentOpen[0] - 300 * TickSize); [B][COLOR=Red] DrawText("Up1", true, "Up1", Up1 ,1, Color.Black, largeFont, StringAlignment.Near, Color.Transparent, Color.Transparent, 0);[/COLOR][/B] } #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 Up1 { 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 Dn1 { get { return Values[1]; } } [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 Up2 { get { return Values[2]; } } [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 Dn2 { get { return Values[3]; } } #endregion } }
suprsnipes
Comment