C# decimal and double values are resolving to zero

  • Thread starter Thread starter DoctorWhoKnew
  • Start date Start date
D

DoctorWhoKnew

Guest
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();

Continue reading...
 
Back
Top