F
Frankdot
Guest
Hello,
I am trying to create multiple moving averages. allbar enumerate from 1 to 100. But at the end cma is not returning 100 cumulative moving averages because its testing only one number, probably the last 100. It should return 100 cma's. How can i solve this?
Thank you
List<int> alllist = new List<int>() {allbar};
for(int i = 0; i < alllist.Count; i++)
{
alllist = alllist;
for(int barsAgo = alllist; barsAgo <= CurrentBar; barsAgo++)
{
double closePrice = Close[barsAgo];
double volumes = Volume[barsAgo];
double clovol = closePrice * volumes;
sum1 += clovol;
sum2 += volumes;
cma = sum1 / sum2;
}
}
Continue reading...
I am trying to create multiple moving averages. allbar enumerate from 1 to 100. But at the end cma is not returning 100 cumulative moving averages because its testing only one number, probably the last 100. It should return 100 cma's. How can i solve this?
Thank you
List<int> alllist = new List<int>() {allbar};
for(int i = 0; i < alllist.Count; i++)
{
alllist = alllist;
for(int barsAgo = alllist; barsAgo <= CurrentBar; barsAgo++)
{
double closePrice = Close[barsAgo];
double volumes = Volume[barsAgo];
double clovol = closePrice * volumes;
sum1 += clovol;
sum2 += volumes;
cma = sum1 / sum2;
}
}
Continue reading...