I am trying to take the SMA of the closes within a multiple bars script I'm working. I found a previous example from the forum for exactly this. So I copied this and put it in:
#region Variables
private DataSeries ds1;
#endregion
protected override void Initialize()
{
Add("SHY", PeriodType.Minute, 1);
CalculateOnBarClose = false;
ds1 = new DataSeries(this);
}
protected override void OnBarUpdate()
{
if(BarsInProgress == 0)
{
ds1.Set(Closes[0][0] / Closes[1][0]);
Value.Set(SMA(ds1, 14)[0]);
}
{ Do something.....
)
}
But when I go to compile, I keep getting an error stating ds1 and Value are not in the current context. I will check tonight, but I believe it compiles as long as I don't have the Value.Set(SMA(ds1, 14)[0]); included. What am I doing wrong?
Thanks,
Regards,
Lee
Comment