Krypto-trading-bot: 💰💰 New AP mode: 4EMA 💰💰

Created on 26 Nov 2017  ·  26Comments  ·  Source: ctubio/Krypto-trading-bot

Hi Carles and all,

This is an improvement that I personally use (by using ewma trend to do it) but I think it will benefit everyone to incorporate it as a new AP mode. And on the plus side, it's only a couple of line of code!

The idea is simple to understand, you use two couple of ema, one couple very long for the trend and one shorter defining the TBP.
If the trend is down, TBP = 0 and if trend is up is defined normally by the other ema.

So in mg.h it would give something like:

        } else if (qp->autoPositionMode == mAutoPositionMode::EWMA_4)
            if mgEwmaTRENDShort < mgEwmaTRENDLong 
              newTargetPosition = 0
            else if mgEwmaTRENDShort > mgEwmaTRENDLong
              newTargetPosition = ((mgEwmaS * 100/ mgEwmaL) - 100) * (1 / qp 
>ewmaSensiblityPercentage);

It acts as a protection against false signal when the ewma can be up, but the general trend is down so you're likely to lose.
Here is a couple of examples where it shows its efficacity.

This morning in ETH/USD: With normal ema you would buy at 9am and sell at 5pm with a probable loss.
If you use ewma 4, you don't buy because the trend is down since 3am.
telechargement 3

Here in BTG/USD using normal ema you would buy on that "dead cat bounce" using ewma 4 you don't buy because the trend is down.

Also, note how you sell at 380 when the short ewma pair is crossing down, long before the trend changes when the price is at 330.
telechargement 4

I hope it's clear how it works!
It will really help everyone trading using this technique:
_ less false signals
_ Better sell

And only a couple of line of code to add :)

Best,

Camille

genius improvement

All 26 comments

Hi @Camille92
i fiddled around with your lines of code. Think its not that big thing to implement.
But there are some questions i have about your idea:

  • The mgEwmaTRENDShort and mgEwmaTRENDLong are the values taken from ewmaTrend called micro and ultra, right?

  • if so, then we need them to be configurable and to be calculated even if ewmaTrend is switched off? Maybe we place them beside the ewma short value?

  • and at last: is it helpful to also have the micro and ultra lines displayed in the stats?

Hi @b-seite

Thank you for looking at it,

I think it was a bit confusing of me to label them "mgEwmaTREND", but what I mean is a new couple of ewma.

So in total, the bot has 4 ewma to define TBP (a long couple and a shorter couple), 2 ewma for ewma trend as it is currently and 1 ewma for safety. :)

Like you could have,
A long couple of 1000/500 and a shorter couple of 400/200 and ewma trend of 50/25 for instance. :)

Like you could have,
A long couple of 1000/500 and a shorter couple of 400/200 and ewma trend of 50/25 for instance. :)

This ewma periods is hardcoded to K?

Why I ask..
1) I see opportunity to set 3 ewma's in TECHNICAL ANALYSIS -> apMode in case I setup EWMA_LWS. In this case confused manual, where I see "medium - Not used yet."
2) I see "ewma?" checkbox in PROTECTION with opportunity set "periodsᵉʷᵐᵃ".
3) I see "ewmaTrend?" in PROTECTION with micro and small periods inputs.

Then your digits "A long couple of 1000/500 and a shorter couple of 400/200 and ewma trend of 50/25 for instance. :)" is confusing more again! Another confusing, if I not switch apMode from Manual or dont set checkboxet for "ewma?" and "ewmaTrend? K bot continue calculating some ewma and with what default periods??!..

There's nothing hardcoded in K, you have default values if you didn't change them.
I was just giving an example to @b-seite for him to understand what we WILL be able to do.

We're talking about an improvement that is not implemented yet, that's why you can't see it.
It will appear in the apMode section under the name "EWMA_4" when it's implemented.

Medium is used only for EWMA_LMS atm.

@Camille92 EWMA_L2S2, EWMA_Lx2Sx2 or if you choose Medium for shorter, EWMA_L2M2, EWMA_Lx2Mx2

Labelling is really not the most important part of the idea ^^

Yep, but when you see K first time you already don't think so!
I know that @b-seite now have more questions after my fist post in this thread!

Ah okey, think i understood it (almost)
try my best to code it.
Yea and still the question how to name the new couple: long2/short2 or LongSafety/ShortSafety or LongS/ShortS ?

LongSafety sounds the best to me!

Or simply:
Verylong, long, medium, short
So that we use the already existing framework.

@b-seite just need add verylong to existing "long, medium, short" in new EWMA_4 or EWMA_VLMS if we rely on existing EWMA_* options.

okey, ill name the one missing verylong and use the other three existing.

next question: in your snippet you wrote
if mgEwmaTRENDShort < mgEwmaTRENDLong newTargetPosition = 0
do you mean 0 = 0% TBP because a 0 here means 50% TBP

Yes I meant 0%, so -1 in fact.

Thanks for spotting the mistake !

Le 29 nov. 2017 19:30, "B-Seite" notifications@github.com a écrit :

okey, ill name the one missing verylong and use the other three existing.

next question: in your snippet you wrote
if mgEwmaTRENDShort < mgEwmaTRENDLong newTargetPosition = 0
do you mean 0 = 0% TBP because a 0 here means 50% TBP


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ctubio/Krypto-trading-bot/issues/431#issuecomment-347952357,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGizFgO-4QaOUhOMyFBV2sQjZ3YbJumyks5s7aKngaJpZM4Qq1Y-
.

Your bot still make orders when you on all solutions ewmaTrend? + STDEV + EWMA_4 ?! :)
Or there is no limit to perfection!?

I make fewer trades for sure, but I make fewer mistakes as well.

Ewma_4 allows you to be skeptical of a rise in a daylong/weeklong downtrend. It allows you to look at two different time frames simultaneously before you commit to buy.

EwmaTrend on the other side delays the decision of buying by taking in consideration very short-term movements. If you TBP tells you to sell but it has been rising for the past 20 minutes, you're going to wait for this uptrend to be done before you sell. It can easily make you save some %.

@Camille92 Camill it looks like genius solution (), but how to understood behavior TBP in this case:

newTargetPosition = ((mgEwmaS * 100/ mgEwmaL) - 100) * (1 / qp 
>ewmaSensiblityPercentage);

It's the same as it is now mate, if the difference between ewma medium and short is equal or greater than "sensibility" then TBP = 0% or 100% depending on which one is on top.
If defines proportionally TBP depending on your sensibility.

So if ewma short > ewma long by 0.25%, and sensibility = 0.5%, TBP = 75%

as i understand it, the calculation is exactly the same as normal EWMA calculation (we just use different values, mgEwmaS and mgEwmaM)

@Camille92 i test the code at the moment and during test i wondered if we maybe could generalize the calculation to work in both directions.
Something like if medium/short pair is negative and Verylong/Long pair is positive then TBP = 100% and opposite if medium/short pair is positive and Verylong/Long pair is negative then TBP = 0%
But i really don't know if something like that makes sense. I am not good enough in market analysis for that. Do you have an Idea or a clue? Or maybe the idea is complete bullshit

Yes the calculation is the same :).

To answer to your examples:
if medium/short pair is negative and Verylong/Long pair is positive then TBP = 100%
In that case medium/short is useless and you can just use EWMA_LS.

if medium/short pair is positive and Verylong/Long pair is negative then TBP = 0%
It's exactly what we are doing already :)

          if (mgEwmaL < mgEwmaVL)
            newTargetPosition = -1;

VL / L has the hand over M / S.

okey, thanks for the quick reply.

Then we leave it like it is for now :)

@b-seite Some checks were not successful in pull https://github.com/ctubio/Krypto-trading-bot/pull/444

Thanks for the info.
It seems to be something with Travis and npm (ts-node not found).
But I'm quiet sure, that has nothing to do with the code

Think we can close this?
Anybody any experiences or known bugs/erros?

Yes I think so :)

Le 10 déc. 2017 14:54, "B-Seite" notifications@github.com a écrit :

Think we can close this?
Anybody any experiences or known bugs/erros?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ctubio/Krypto-trading-bot/issues/431#issuecomment-350549973,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGizFrio_mvIL3wWGFoS2jTKXl07slBUks5s--KegaJpZM4Qq1Y-
.

Closing because it's implemented!

Thanks all for the work, I hope it's helping you in your trading decisions :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nonkreon picture nonkreon  ·  5Comments

adirta picture adirta  ·  4Comments

Bzzz666 picture Bzzz666  ·  8Comments

donaldforest picture donaldforest  ·  5Comments

nonkreon picture nonkreon  ·  5Comments