-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IMPROVEMENT: New ApMode -> 3 EWMA System #115
Comments
so this is to replace the current EWMABasic (long and short) with 3 (long, medium, short?) or you wanna keep current EWMABasic functionality available to be selected too? |
I think keeping the Ewma basic can't hurt! And it follows the logic of the "more option the better". I wanted to do it, but I don't know where is the length of an ewma defined in Tribeca. Ps: Thank you for the "genius improvement" I'm very flattered! |
coOl ok lets keep all options 💃 i believe thats what caused all my confusion with ewma value, cos at the end is pretty simple concept xD the issue is that currently tribeca calculcates the ewma values using the accumulated calculated value, not the sequence of recorded values. Using https://github.com/ctubio/tribeca/blob/master/src/server/main.ts#L76 at https://github.com/ctubio/tribeca/blob/master/src/server/statistics.ts#L44 where So, every 10 minutes - lets say, tribeca takes the fair value, the last ewma, and the magic factor ewmaLong or ewmaShort from main.ts to calculate the next current ewma value. no need for a sequence. Then, if we want to modify this as you said, or we start using a sequecnce of recorded periods with customizable length, or otherwise we need to work with this magic factor value, that is not easy to understand at the first glance for the normal (like me) user. (is neat for computing resources, but is not easy to make use of it from the human point of view) how feels in your body? xD |
Hum I see, I'm not 100% sure how to adjust this vector. Otherwise, I bumped into that googling https://github.com/fredrick/gauss#vectorema would that be easier and efficient? |
yea lets grab that function xD seems more robust for sure; then lets continue trying to customize it using the new ewma function xD awesome plan'¡ |
Yeahh! So cool and it offers a lot of stats tools to play with them after! :) |
Ps: For the sake of easy comparison with ewma classic in the definition of sensibility. I think it's better to use the average of 2. So: |
To support commits at ctubio/tribeca, you can buy-me-a-drink with a small git tip at: 1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u I promise to drink chocolate milk in the development of the next commit. To request new features or in case this commit breaks something for you, please create a new github issue with all possible details, but never share your API Keys! Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
ok so now we have medium ewma, but i dont think sensibility should be a customizable value (cos i dont see it as an option in any other charts out there where you can confiugure some ewmas [not because i have an idea xD]) do you really think sensibility should be customizable? |
Hey yes, I still think so haha. It can be seen as a trigger in case of false breakout, it can be particularly interesting if someone chooses to use smaller ewma :). You can find an example here https://gekko.wizb.it/docs/strategies/example_strategies.html it's what's usually referred to as the "threshold" :) |
A general argument in favor of customization is that any trading strategy, as good as it can be if it is used by a lot of people will not work at all. So by having different settings we assure that the probability for two Tribeca' users to have the same strategy is greatly reduced. In the end, this makes Tribeca stronger for having extra people to use it without killing everyone's profit :) |
ok so, 1 sensibility or 2 customizable sensibilities? cos we have ewma protection but also ewma position rebalancing :S ty for your time'' |
Only one for the ewma position rebalancing because this one acts as a "buffer" to TBP. It allows having values between 0 and full BTC for your tbp. The other one is just a protection, using the ewma as a minimum value. If we want this one to be more reactive we just change the length of the ewma :) |
ah yea i understand now xD |
ok so last quesiton i hope: let newTrend = ((this.SMA3 * 100/ this.newLong) - 100);
let newEwmacrossing = ((this.newShort * 100/ this.newMedium) - 100);
let newTargetPosition = ((this.newTrend + this.newEwmacrossing)/2) * (1/sensibility); SMA3 is the result of calculate the ewma of the fair value using 3 periods? so the alpha variable for SMA3 should be: 2 / (3 + 1), no? theen.. is not ewma3 same as sma3? xD |
Hey no problem for the questions, SMA is the simple moving average of the price it means: But after looking at a chart they look very very very similar so EWMA 3 or 5 or SMA 3 or 5 should all do the job perfeclty. (Look at the chart below). What we need here is just a very very short average that reflects the current price BUT are not subject to a 1mn explosion of the price. :) |
ok finally something easy :D many thanks'¡ |
hope you dont miss nothing'¡ as far as i could test is niiiiice |
ah yea we miss EwmaBasic now xD will recover tomorrow |
To support commits at ctubio/tribeca, you can buy-me-a-drink with a small git tip at: 1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u I promise to drink chocolate milk in the development of the next commit. To request new features or in case this commit breaks something for you, please create a new github issue with all possible details, but never share your API Keys! Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com> To support commits at ctubio/tribeca, you can buy-me-a-drink with a small git tip at: 1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u I promise to drink chocolate milk in the development of the next commit. To request new features or in case this commit breaks something for you, please create a new github issue with all possible details, but never share your API Keys! Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
Yess it looks good! I need a few days to see if it's giving good results as expected but so far so good! |
Free Software Free Society To support commits by ctubio, you can buy-me-a-drink with a small git tip at: 1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u I promise to drink chocolate milk in the development of the next commit. To request new features or in case this commit breaks something for you, please create a new github issue with all possible details, but never share your API Keys! Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
Free Software Free Society To support commits by ctubio, you can buy-me-a-drink with a small git tip at: 1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u I promise to drink chocolate milk in the development of the next commit. To request new features or in case this commit breaks something for you, please create a new github issue with all possible details, but never share your API Keys! Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
Free Software Free Society To support commits by ctubio, you can buy-me-a-drink with a small git tip at: 1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u I promise to drink chocolate milk in the development of the next commit. To request new features or in case this commit breaks something for you, please create a new github issue with all possible details, but never share your API Keys! Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
Free Software Free Society To support commits by ctubio, you can buy-me-a-drink with a small git tip at: 1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u I promise to drink chocolate milk in the development of the next commit. To request new features or in case this commit breaks something for you, please create a new github issue with all possible details, but never share your API Keys! Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
Free Software Free Society To support commits by ctubio, you can buy-me-a-drink with a small git tip at: 1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u I promise to drink chocolate milk in the development of the next commit. To request new features or in case this commit breaks something for you, please create a new github issue with all possible details, but never share your API Keys! Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
Hello Carles and everyone,
I keep going with my "one improvement a week" idea, but this one is easy to implement and will, hopefully, give big rewards.
The concept is to ameliorate today's ewma basic by adding to it more ewma.
Originally this is a scalping strategy that I adapted for Tribeca. It should be faster to react to the market while still keeping into account longer ewma.
Read more here https://www.forexstrategiesresources.com/scalping-forex-strategies/2-scalp-with-emapredictive/ and here http://www.profitf.com/forex-strategies/3-ema-scalping-system-1-min/
1) Necessary and configurable parts:
Recommanded default values:
ewmaLong : 200, ewmaMedium: 100, ewmaShort: 50, sensibility: 0.5%
The sensibility represents the % you have between 2 ewma to activate a target position of nothing or everything. It is currently configured at 0.2% for Tribeca.
I recommend using 0.5% because we're going to add percentages.
2) Calculation:
Here is the original formula of EWMA basic:
let newTargetPosition = ((this.newShort * 100/ this.newLong) - 100) * 5;
in https://github.com/ctubio/tribeca/blob/master/src/server/position-management.ts
If 3EWMA mode is activated, here is what the calculation should look like:
let newTrend = ((this.SMA3 * 100/ this.newLong) - 100);
let newEwmacrossing = ((this.newShort * 100/ this.newMedium) - 100);
let newTargetPosition = ((this.trend + this.ewmacrossing)/2) * (1/sensibility);
3) Explanation
What we do here is to determine a trend, so if the market is above or under the ewmaLong and we add to it a shorter term crossover.
If the trend is up new Trend will be positive and add positive value to the TP calculation.
If it's negative, it will give a negative value to TP calculation.
Same for ewma crossing.
In practice, it means that -> if we have both a positive crossing and the market above the trend line, TBP position will be high.
If both are negative -> TP will close to 0
If one is negative and the other one positive, TP will be around neutral and its sign will depend on the strength of the movement.
4) Comparison with EWMA Basic:
3 ewma: (50,100, 200)
![capture d ecran 2017-05-31 a 17 56 47](https://cloud.githubusercontent.com/assets/6861590/26641377/ad807c10-462a-11e7-965e-b261d6a15899.png)
![capture d ecran 2017-05-31 a 17 56 13](https://cloud.githubusercontent.com/assets/6861590/26641385/b2dab248-462a-11e7-8a8e-9ad5f7e760a3.png)
ewma classic: (100, 200)
Please tell me what you think and if you have any questions!
Ps: We can link that to #114 with the idea of making ewmaShort, Long, sensibility and time interval customizable !
The text was updated successfully, but these errors were encountered: