writing my first class in NT and i stuck;
I cannot figure out how to Bars.GetBar working in the class object i defined.
tTe method works perfectly fine in "protected override void OnBarUpdate()"
but if I want to use it in my own class, it would give me an compile error
"an object reference is required for non-static field, method.."
what do i need to do? tks!
public class TrendLine{
private string trendLineType;
private DateTime x1;
private DateTime x2;
private double y1;
private double y2;
private int penetrationCount;
public DateTime X1
{
get
{
return x1;
}
set
{
x1 = value;
}
}
public DateTime X2
{
get
{
return x2;
}
set
{
x2 = value;
}
}
public double Y2
{
get
{
return y2;
}
set
{
y2 = value;
}
}
public double Y1
{
get
{
return y1;
}
set
{
y1 = value;
}
}
public int GetBarAgoX1()
{
DateTime timeOfInterest;
int barsAgo;
timeOfInterest = new DateTime(2014, 2, 20, 9, 30, 0);
barsAgo= Bars.GetBar(timeOfInterest);
Return barsAgo;
}
}
Comment