I have been playing around with indicators, and am just trying to draw a simple line based on the examples and documentation. However, I just cannot get it to draw. Nothing appears. Below is the code:
namespace NinjaTrader.NinjaScript.Indicators
{
public class TestPivot3 : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "TestPivot3";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
}
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, 1);
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
double PivotPoint = (High[1] + Low[1] + Close[1]) / 3;
Draw.Line(this, "PP" + CurrentBar, false, 10, Low[0], 0, Low[10], Brushes.LimeGreen, DashStyleHelper.Dot, 2, true);
// Draws a blue rectangle from the low 10 bars back to the high of 5 bars back
Draw.Rectangle(this, "tag1", 10, Low[10] - TickSize, 5, High[5] + TickSize, Brushes.Blue);
}
}
}
Thank you

Comment