0

I am expecting weight value to be 0.153846 in the code below. Instead I am getting 0. I tried using double and decimal. period is 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();

The is indeed a duplicate. I did search but did not find this answer.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Jam66125
  • 163
  • 2
  • 8

0 Answers0