Remove comments containing original generic (i.e., non-IQFeed) market depth code

This commit is contained in:
moshferatu 2024-04-07 06:32:44 -07:00
parent 2297e5b9d4
commit ef4be98080

View File

@ -125,8 +125,6 @@ namespace NinjaTrader.NinjaScript.Indicators
public class MarketDepth : Indicator
{
private const int MaxDepth = 10;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
@ -160,14 +158,10 @@ namespace NinjaTrader.NinjaScript.Indicators
{
base.OnRender(chartControl, chartScale);
/*if (Instrument.MarketDepth.Asks.Take(MaxDepth).IsNullOrEmpty() || Instrument.MarketDepth.Bids.Take(MaxDepth).IsNullOrEmpty())
return;*/
if (MarketDepthProcessor.Asks.Count() <= 0 || MarketDepthProcessor.Bids.Count() <= 0)
return;
// Find the max volume for scaling
//long maxVolume = Math.Max(Instrument.MarketDepth.Asks.Take(MaxDepth).Max(a => a.Volume), Instrument.MarketDepth.Bids.Take(MaxDepth).Max(b => b.Volume));
// Find the max volume for visually scaling the indicator.
long maxVolume = Math.Max(MarketDepthProcessor.Asks.Values.ToList().DefaultIfEmpty(0).Max(),
MarketDepthProcessor.Bids.Values.ToList().DefaultIfEmpty(0).Max());
@ -192,26 +186,6 @@ namespace NinjaTrader.NinjaScript.Indicators
int y = chartScale.GetYByValue(price);
DrawHorizontalLine((ChartPanel.X + ChartPanel.W) - length, ChartPanel.X + ChartPanel.W, y, new Stroke(Brushes.LimeGreen, DashStyleHelper.Solid, 3));
}
/*for (int i = 0; i < MaxDepth; i++)
{
var ask = Instrument.MarketDepth.Asks[i];
int length = (int)((double)ask.Volume / maxVolume * 300);
// Assuming we're drawing from left to right
int y = chartScale.GetYByValue(ask.Price);
DrawHorizontalLine((ChartPanel.X + ChartPanel.W) - length, ChartPanel.X + ChartPanel.W, y, new Stroke(Brushes.Red, DashStyleHelper.Solid, 2));
}
for (int i = 0; i < MaxDepth; i++)
{
var bid = Instrument.MarketDepth.Bids[i];
int length = (int)((double)bid.Volume / maxVolume * 300);
// Assuming we're drawing from left to right
int y = chartScale.GetYByValue(bid.Price);
DrawHorizontalLine((ChartPanel.X + ChartPanel.W) - length, ChartPanel.X + ChartPanel.W, y, new Stroke(Brushes.LimeGreen, DashStyleHelper.Solid, 2));
}*/
}
protected override void OnBarUpdate() {}