|
|
Questions and Answers
Started by sandrov at 10-28-2007 7:55 AM. Topic has 3 replies.
 
 
|
|
Sort Posts:
|
|
|
|
10-28-2007, 7:55 AM
|
sandrov
Joined on 10-19-2007
Posts 2
|
|
|
|
LS.,
First of all I think this site is a brilliant initiative!
I've downloaded the sourcecode and found a small implementation glitch in the EMA function at approx. line 387 (indicators.cs). When the tickcount equals periods: no calculation is done with the input value Val. In order to correct this the code should be like:
If (tickcount == periods)
{ emav += Val;
emav /= (periods+1);
}
Cheers,
Alexander
|
|
|
|
|
Report
|
|
|
|
12-20-2007, 11:50 AM
|
JoeMama
Joined on 06-07-2007
Posts 5
|
|
|
Is this a valid fix, can you post the whole function so I can see your change against the original
|
|
|
|
|
Report
|
|
|
|
03-02-2008, 9:03 AM
|
sandrov
Joined on 10-19-2007
Posts 2
|
|
|
|
public void ReceiveTick(double Val) { if (tickcount < periods) emav += Val; if (tickcount ==periods)
// added this line, otherwise the Val is disregarded emav += Val; emav /= periods; if (tickcount > periods) emav = (dampen*(Val-emav))+emav;
if (tickcount <= (periods+1) ) { // avoid overflow by stopping use of tickcount // when indicator is fully primed tickcount++; } }
|
|
|
|
|
Report
|
|
|
|
|
4XLab.NET : For... » 4XLab.NET » Questions and A... » iEMA implementation
|
|
|
|