It give me error that say "The name, Draw does does not exist on the current cc.
Any good programmer out there who could correct it ?
__________________________________________________ __________________________________________________ ____________
using System;
using System.Collections.Generic; // For List<>
using NinjaTrader.Gui.Tools; // For GUI tools
using NinjaTrader.NinjaScript; // For NinjaTrader scripting
using System.Windows.Media; // For Brushes
namespace NinjaTrader.NinjaScript.Indicators.Infinity
{
public class SupandDemwithLine : Indicator
{
region Zone Class
public class Zone
{
public double h = 0.0; // high
public double l = 0.0; // low
public int b = 0; // bar
public string t = ""; // type (supply/demand)
public bool a = true; // active
public Zone(double l, double h, int b, string t, bool a)
{
this.l = l;
this.h = h;
this.b = b;
this.t = t;
this.a = a;
}
}
#endregion
region Variables
private List<Zone> Zones = new List<Zone>();
private int barIndex = 0;
#endregion
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Name = "SupandDemwithLine";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
}
}
protected override void OnBarUpdate()
{
if (CurrentBars[barIndex] < 20)
return;
checkSupply();
checkDemand();
}
private void checkSupply()
{
// Example detection logic (replace with actual)
bool supplyZoneDetected = High[0] > High[1]; // Simplified logic
if (supplyZoneDetected)
{
double supplyHigh = High[0];
double supplyLow = Low[0];
// Add zone
Zones.Add(new Zone(supplyLow, supplyHigh, CurrentBar, "s", true));
// Corrected: Use fully qualified Draw methods
Draw.ArrowDown(this, $"SupplyArrow_{CurrentBar}", false, Time[0], supplyHigh + TickSize * 2, Brushes.Red);
}
}
private void checkDemand()
{
// Example detection logic (replace with actual)
bool demandZoneDetected = Low[0] < Low[1]; // Simplified logic
if (demandZoneDetected)
{
double demandHigh = High[0];
double demandLow = Low[0];
// Add zone
Zones.Add(new Zone(demandLow, demandHigh, CurrentBar, "d", true));
// Corrected: Use fully qualified Draw methods
Draw.ArrowUp(this, $"DemandArrow_{CurrentBar}", false, Time[0], demandLow - TickSize * 2, Brushes.Green);
}
}
}
}

Comment