D
DoctorWhoKnew
Guest
I am writing a financial app and completed the Moving Average using C# with the outstanding help from this forum. I am working on the MACD. The MACD function is getting too long and I am repeating code. I want to created a function SMA and call it to the MACD function. I created this class but I get an error:
namespace myBackEnd
{
public class SMA
{
public decimal SMA (Queue<Models.DateClose> queue, int period) <--- error here
{
decimal average, sum=0;
for (int i = 0; i < period; i++)
{
Models.DateClose dateClose;
dateClose = queue.Dequeue();
sum += dateClose.Close;
}
return average = sum/period;
}
}
I get an error 'member name cannot be the same as enclosing name". How can I fix this?
Continue reading...
namespace myBackEnd
{
public class SMA
{
public decimal SMA (Queue<Models.DateClose> queue, int period) <--- error here
{
decimal average, sum=0;
for (int i = 0; i < period; i++)
{
Models.DateClose dateClose;
dateClose = queue.Dequeue();
sum += dateClose.Close;
}
return average = sum/period;
}
}
I get an error 'member name cannot be the same as enclosing name". How can I fix this?
Continue reading...