ctubio / tribeca

Self-hosted crypto trading bot (automated high frequency market making) in node.js, angular, typescript and c++
https://127.0.0.1:3000
Other
95 stars 26 forks source link

Updating EWMA in a more convenient way #120

Closed Camille92 closed 7 years ago

Camille92 commented 7 years ago

Hello Carles,

I was looking at the formula that you pointed and Michael gave to calculate the EWMA.

What I've found is that we were actually calculating an ewma 20 and ewma 10 but every 10 minutes.

This update calculates the ewma 200 and 100 every minute and also makes it easier to understand what period we're using (look at the formula in main.ts).

Another idea for #114 is to be able to change the number in this formula by whatever number we want to in the web UI.

Please check if I'm not wrong before merging and that it was actually an ewma 10 and 20 that was calculated! :)

Camille92 commented 7 years ago

look here for more details about the calculation and the definition of the alpha factor

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages


 Multiplier: (2 / (Time periods + 1) ) = (2 / (10 + 1) ) = 0.1818 (18.18%)

EMA: {Close - EMA(previous day)} x multiplier + EMA(previous day). 
coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 49.452% when pulling 6329899f24f62c475f87e7c675ad2fec6ffc615a on Camille92:patch-17 into a599f7026cb1524e52af49e0188751ced1b70828 on ctubio:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 49.452% when pulling 6329899f24f62c475f87e7c675ad2fec6ffc615a on Camille92:patch-17 into a599f7026cb1524e52af49e0188751ced1b70828 on ctubio:master.

ctubio commented 7 years ago

but but is friday and i hate math, can't this just be merged? :dancer: xD no ok you're right, let me rrrreview this just for the sake of once and for all understand and close ewma issues.

seriously many thanks for insist into this

Camille92 commented 7 years ago

Haha well I've been giving a bit of thinking of that.

But better being 100% sure there's no mistake so we can move on to upgrading ewma strategies (but only when we're sure there's no mistake) :)

Camille92 commented 7 years ago

Sorry for ruining your Friday :p

ctubio commented 7 years ago

certainly this is making every 1 minute an effective ewma calculation of 100 and 200, while allowing easy customizable periods value, and still without using a sequence, awesome'¡

end up friday with a bigger brain again, thanks'¡