c# - Exponential Moving Average with different kernels -


I am trying to replicate some formulas, but there is a problem translating mathematics into code.

Here is a simple exponential moving average exponential moving average

C #:

  outside [1] = value [1]; For (i 2: n (x)) {tmp = (bar [ii] - bar [ii]] / tau; W = exp (-mp); W2 = (1 - w) / tmp; Outside [i] = out [i-1] * w + value [i] * (1 - w2) + value [i-1] * (w2 - w); }  

In Python:

  Mu = numpy.exp ((ts [1] - ts [0]) / self.tau = New = 1.0 - Mu return numpy.array ([Mue * L * No * Arrival [0] L, zip for arrival (past, arrays)])  

I enable to specify different Be sure to have the kernel and make sure to go about it as described here: EMA kernel MA All this has been done so I finally got this moving variable I can rebuild my heart: Enter image details here

Any help Thanks for this

Here is a possible way to have a method that gives to the kernel

What I can see, this method will have input kerneltype , i , and other input .

A simple perspective would be:

 for  (int i = 1; i & lt; values.length (); i ++) {tmp = (bar [ I] - bar [i-1]) / tau; // w = exp (-mp); // w2 = (1 - w) / tmp; & Lt; Object & gt; KernelInputsInital = New list & lt; Object & gt; (); KernelInputsInitial.Add (tmp); // takes the first argument in InputsInitial.Add (true); // is expected to calculate the first w = GetKernel (KernelType.Exponential, i, kernelInputsInitial); & Lt; Object & gt; KernelInputsSecondTerm = New List & lt; Object & gt; (); (W) kernelInputsSecondTerm.Add; // In the first argument takes IninputsSecondTerm.Add (wrong); // is expected to calculate the first w2 = GetKernel (KernelType.Exponential, i, kernelInputsInitial); Outside [i] = out [i-1] * w + value [i] * (1 - w2) + value [i-1] * (w2 - w); ....}  

This is definitely very, very difficult, and a lot of improvement can be done, but its aim is to get points only Is across

I use an interface to represent a kernel, and each kernel is generated per square. In my experience, he produces adequately readable and maintained code, but there is always a place for improvement.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -