Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Holidays and equations

Help
2007-12-26
2013-04-24
  • Hi there!

    Absolutely magnificent project! Congratulations! I'm currently interested in genetic programming, neural nets and stuff, so Venice (or MOV???) is really astonishing me. I can only program in C++ or Pascal, so I am not really able to help you guys, but I would really want to!

    Actually, I just wanted to ask, how should I properly calculate EMA or AVG using Gondola? I'm using this code for AVG:

    const int n = 26
    float average = 0.0
    for(int i = (-1)*n+1; i <= 0; i = i + 1) {
    average = lag(close,i)+average
    }
    average/n

    Quite simple, but it doesn't work as native AVG. And I managed to find out, why. I use imported quotes from my OMX markets (Baltic Sea, Europe) and some days (non weekend) has no data. For example, Nov 1 has a holiday, and no one is working. Nov 2 is Friday, so it is also made holiday day and, and after that weekend follows. 4 days, and no data about stocks. OK, 2 days from weekend is normal, but 2 days in mid-week isn't good and lag(close, -1) at NOV 5 (Monday) returns 0, because Friday has no data. Therefore, user-made AVG and other algorithms provide bad answers, because they aren't aware of those zero-gaps. Any solutions, how to make correct AVG's and EMA's? Actually, I want to calculate MACD EMA, which is not native function. I have an idea, to artificially double Oct 31 close price to Nov 1 and Nov 2, but there are too many other gaps, and too many other symbols.