"Cannot access a non-static member of outer type 'NinaTrader.Indicator.IndicatorBase' via nested type 'NinjaTrader.Indicator.csharplearning.Rectangle"
Code is:
public class csharplearning : Indicator
{
#region Variables
Rectangle r = new Rectangle();
#endregion
protected override void Initialize()
{
r.Acceptdetails();
r.Display();
}
protected override void OnBarUpdate()
{
}
class Rectangle
{
double length;
double width;
public void Acceptdetails()
{
length = 4.5;
width = 3.5;
}
public double GetArea()
{
return length * width;
}
public void Display()
{
// produces error message - Print function appears to be invalid here
Print("test");
}
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Plot0
{
get { return Values[0]; }
}
// [Description("")]
// [GridCategory("Parameters")]
// public int MyInput0
// {
// get { return myInput0; }
// set { myInput0 = Math.Max(1, value); }
// }
#endregion
}

Comment