我期望以下代码中的权重值为0.153846。相反,我得到0。我尝试使用双精度和十进制。期间是10
public static Deque<DateClose> EMAMethod(
Queue<DateClose> queue,
Deque<DateClose> firstEMASample,
int period)
{
double weight = (2/(period+1));
Deque<DateClose> sample = new Deque<DateClose>(firstEMASample.ToArray());
Deque<DateClose> expoMovingAverageQueue = new Deque<DateClose>(queue.Count() + 1);
// get the last item or initial MA value from the queue
DateClose eMA = sample.RemoveFromBack();
确实是重复的。我做了搜索,但是没有找到这个答案。