Proper stop losses coming soon
#1
[EDIT]
I'm working hard on implementing native trailing stop losses! Follow this PR: https://github.com/askmike/gekko/pull/2429
[/EDIT]

Stop losses are a very big part of trading successfully, whether it is automated trading or not. Gekko currently does not support proper stop losses (unless users implement those themselves in their strategies, which is far from ideal) due to the complexities around different exchanges API capabilities (most do not support native stop losses at all).

Now Gekko v0.6 is out I am planning to enhance Gekko Broker with proper stop losses while giving strategies a way to include stop losses when giving advice. I'm working on Gekko Plus where I am taking Gekko to the next level and I feel this has to include proper stop losses.

What is a stoploss?

A stoploss is an order designed to get out of a position that might turn the wrong direction, limiting risk. Imagine you are using Gekko to trade on USD/BTC and your strategy sees an opportunity to buy. It will trigger a buy advice and Gekko will gladly buy BTC with your USD. But what if your strategy turned out wrong and the price of BTC tanks? With a stoploss you can limit your potential loss to say 1% by automatically selling the BTC once the price drops 1%. Stop losses are not perfect: If there is a small dip in the price you will sell, even though the price might go up after.

Why are there currently no stop losses?

There are two big reasons for this:

1. Up until recently Gekko had a lot of limitations in the communication between strategies and the module responsible for executing (simulated or real) trade orders at the exchange. Gekko v0.6 introduced a new event system that allows for bi-directional communication needed to update the strategy in case a stop loss gets executed.
2. Not all exchanges support stop losses natively, in cases exchanges don't Gekko needs a way to offer them (by watching the price and trading whenever it hits X). Since v0.6 Gekko comes with a library that can be extended to support this: Gekko Broker.

What will Gekko support in the future?

I haven't fully figured this out yet (which is why I am posting this thread). But this is what I am currently thinking:

- introduce the concept of triggers such as:
  - stop loss (create an order when the price goes AGAINST your direction).
- trailing stop loss (same as above the the price trigger will move with the price, slowly securing more profit).
  - take profit (create an order when the price goes IN your direction - and you want to secure your profit).
- allow for strategies to specify how to execute the trigger, such as:
  - market order
  - sticky order
  - limit order

There is already a "tradeCompleted" event which can be extended to include information about what caused it (an advice, a stoploss or takeprofit trigger). As for now triggers can be passed along with "LONG" (buy) advice signals as to end a roundtrip early (before the strategy adviced to "SHORT" (sell)).

I'm still thinking about this execution part, I might split this design into two phases: first with only triggers and second with more order types.

What do you think?
  Reply


Messages In This Thread
Proper stop losses coming soon - by askmike - 07-07-2018, 07:27 AM
RE: Proper stop losses coming soon - by TCMabe - 07-11-2018, 08:38 PM
RE: Proper stop losses coming soon - by askmike - 07-12-2018, 04:23 AM
RE: Proper stop losses coming soon - by mark.sch - 07-12-2018, 04:41 PM
RE: Proper stop losses coming soon - by askmike - 07-13-2018, 01:36 AM
RE: Proper stop losses coming soon - by mark.sch - 07-13-2018, 09:53 AM
RE: Proper stop losses coming soon - by askmike - 07-13-2018, 12:50 PM
RE: Proper stop losses coming soon - by Kris191 - 07-30-2018, 03:37 PM
RE: Proper stop losses coming soon - by askmike - 07-31-2018, 12:56 PM
RE: Proper stop losses coming soon - by askmike - 08-11-2018, 07:32 AM
RE: Proper stop losses coming soon - by PapoKarlo - 08-12-2018, 10:12 AM
RE: Proper stop losses coming soon - by mark.sch - 08-12-2018, 11:50 AM
RE: Proper stop losses coming soon - by askmike - 08-12-2018, 02:35 PM
RE: Proper stop losses coming soon - by askmike - 08-14-2018, 04:06 AM
RE: Proper stop losses coming soon - by PapoKarlo - 08-14-2018, 04:42 PM
RE: Proper stop losses coming soon - by askmike - 08-14-2018, 04:47 PM
RE: Proper stop losses coming soon - by mark.sch - 08-16-2018, 09:24 AM
RE: Proper stop losses coming soon - by askmike - 08-16-2018, 04:04 PM
RE: Proper stop losses coming soon - by mark.sch - 08-17-2018, 10:26 PM
RE: Proper stop losses coming soon - by askmike - 08-27-2018, 11:49 AM
RE: Proper stop losses coming soon - by askmike - 08-27-2018, 12:27 PM
RE: Proper stop losses coming soon - by mark.sch - 09-06-2018, 11:13 PM
RE: Proper stop losses coming soon - by maxblack - 10-07-2018, 09:46 AM
RE: Proper stop losses coming soon - by mark.sch - 09-03-2018, 12:20 AM
RE: Proper stop losses coming soon - by askmike - 09-03-2018, 04:58 AM
RE: Proper stop losses coming soon - by mark.sch - 09-04-2018, 01:11 PM
RE: Proper stop losses coming soon - by BotsEdge - 09-09-2018, 11:25 PM
RE: Proper stop losses coming soon - by askmike - 09-06-2018, 05:14 AM
RE: Proper stop losses coming soon - by bitsnpcs - 09-11-2018, 11:55 PM
RE: Proper stop losses coming soon - by Presunto - 09-27-2018, 12:43 PM
RE: Proper stop losses coming soon - by askmike - 09-28-2018, 04:16 AM
RE: Proper stop losses coming soon - by askmike - 10-20-2018, 06:14 AM
RE: Proper stop losses coming soon - by askmike - 10-22-2018, 04:26 AM
RE: Proper stop losses coming soon - by askmike - 11-11-2018, 05:01 AM
RE: Proper stop losses coming soon - by askmike - 11-14-2018, 11:15 AM
RE: Proper stop losses coming soon - by askmike - 01-03-2019, 09:05 AM
RE: Proper stop losses coming soon - by askmike - 01-03-2019, 05:28 PM
RE: Proper stop losses coming soon - by hitripley - 01-18-2019, 02:46 PM
RE: Proper stop losses coming soon - by hitripley - 01-18-2019, 03:18 PM

Forum Jump:


Users browsing this thread: