askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.07k stars 3.94k forks source link

Stop loss and limit trading amount #550

Closed tregismoreira closed 7 years ago

tregismoreira commented 7 years ago

Hey guys,

Firstly, thanks for the great bot. The code is very well organized and the community is great! I hope I can give back to you soon ;)

I would like to know if there are any solution for the following subjects:

  1. Stop loss: once bot identify an abrupt drop or aggressive down trend, exit to avoid losses;
  2. Limit trading: Let's say I have 1 BTC, but I just want to trade 0.5 BTC.

Thanks in advance.

ofek-a commented 7 years ago

I'm pretty sure there is no way to do the second part without seriously altering the base code. Regarding the first issue, you can just use indicators and interpret their data the way you want. A very simple example that comes to mind:

if(rsiTrend.low && (rsiTrend.persisted > 6 || rsiVal > 95) && lastAction = "long" && lastLongPrice > candle.close){
    //abrupt short
    advice("short);
}

Another strategy would be to set a stopLoss parameter (lets say 2%) that would check the last long price and compare it to current and if the difference is bigger than the parameter it would abruptly short.

This is just to give you an idea, and would have to be implemented specific to your implementation. Hope this helps.

askmike commented 7 years ago

@OfekA you are right. (I guess that code is for the first question). Limit trading has been a major point of discussion for years now: The problem is that (depending on implementation) it creates a false sense of safety.

tregismoreira commented 7 years ago

@OfekA great suggestion. I'll take a try.

@askmike yeah, it make sense. For now, as I'm testing gekko on Poloniex, I'm limiting the trading amount just by keeping a small amount in the exchange account, then transferring everything else to margin or lending.

Thanks for your reply.

askmike commented 7 years ago

I'm limiting the trading amount just by keeping a small amount in the exchange account

This is considered good practise anyway :)

erasmuswill commented 6 years ago

Well there is an easy hack for limit trading: simply hard-code the logic for the balance never to exceed x amount in your copy of the exchange file.

SeAlgoAsoma commented 6 years ago

Dag. The problem with this is I use a strategy that hedges by using incremental buys as the price moves. Small movements, buy a little. Bigger movements, buy a little more. And so on. This all-or-nothing trading requirement makes Gekko useless for me except for very limited purposes. I'll still have to execute most of my trades by hand. Bummer.

greenbigfrog commented 6 years ago

@SeAlgoAsoma That's out of the scope of gekko (at least unless you modify it heavily). What you're complaining about with gekko is a bit like complaining that you're stove isn't a very good oven.

ghost commented 5 years ago

So am I going to risk all my account for gekko? not being able to limit trading amount really makes the bot useless and not professional. Well, If owner/anyone could make real money using this bot it wouldn't be open sourced anyway.

askmike commented 5 years ago

You make money with a good strategy, not with the framework that is Gekko. Good strategies are not (rarely) open sourced. If you don't like Gekko no one is forcing you to use it, a lot of people don't like it. And it's indeed not focussed on professional quantitative analysts, read here what it's focussed on instead: https://gekko.wizb.it/docs/introduction/scope.html

On Sat, Mar 16, 2019 at 7:21 PM Caner Çakmak notifications@github.com wrote:

not being able to limit trading amount really makes the bot useless and not professional. Well, If owner/anyone could make real money using this bot it wouldn't be open sourced anyway.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/askmike/gekko/issues/550#issuecomment-473521735, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7MDxBMBX1bqbVw5Um5a2x4bEqrmzz6ks5vXNPCgaJpZM4Lk9Tj .

-- PGP key at keybase.io/mikevanrossum https://keybase.io/mikevanrossum/key.asc