I would to have an indicator which shows the numbers of executed contract at the ask and the number of executed contract at the bid within a bar. I just would like to know what's wrong with this code :
public class MyCustomIndicator : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "MyCustomIndicator";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
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;
AddPlot(Brushes.ForestGreen, "Volume Ask");
AddPlot(Brushes.Red, "VolumeBid");
}
else if (State == State.Configure)
{
AddDataSeries("AAPL", BarsPeriodType.Minute, 1, MarketDataType.Ask);
AddDataSeries("AAPL", BarsPeriodType.Minute, 1, MarketDataType.Bid);
}
}
protected override void OnBarUpdate()
{
VolumeAsk[0] = Volume[0][1];
VolumeBid[0]= Volume[0][2];
}
}
}


Comment