I am trying to code a indicator that will plot and show the value of the opening price for the day. Here is what I got but I'm getting the error that System.Window.Media.Color does not contain a definition for blue. I'm getting the same error message for Solid in the dashStyles. Thanks for the help
Here is what I have...
using System;
using System.Linq;
using System.Drawing;
using System.Windows.Media;
using NinjaTrader.NinjaScript;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion
namespace NinjaTrader.NinjaScript.Indicators
{
public class OpeningPriceLine : Indicator
{
private double openingPrice;
private Brush lineColor = Brushes.Blue;
private DashStyle lineStyle = DashStyle.Solid;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "Draws a horizontal line at the opening price of the 8:30am CST bar.";
Name = "OpeningPriceLine";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
DisplayInDataBox = true;
DrawOnPricePanel = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
}
}
protected override void OnBarUpdate()
{
if (Time[0].TimeOfDay == new TimeSpan(8, 30, 0))
{
openingPrice = Open[0];
}
Draw.Line(this, "Opening Price Line", false, 0, openingPrice, -1, openingPrice, Color.Blue, DashStyle.Solid, 2);
}
}
}
Comment