Giter VIP home page Giter VIP logo

Comments (12)

laredoza avatar laredoza commented on August 27, 2024 1

Hi,

I've added an initial implementation of a TrailingStop strategy:
https://github.com/laredoza/gekko/blob/stable/strategies/L1-TrailingStop.js
https://github.com/laredoza/gekko/blob/stable/config/strategies/L1-TrailingStop.toml
Still needs a lot of testing though, so don't trust it.

A nice description can be found here:
https://www.youtube.com/watch?v=kY9n8EQqs7w

A. Where this strategy works:

  1. Initial buy at $100, sell order at $110, stop order = 98$(trailingValueIncrement = $2) --> Market value hits $110. You == Trading God
  2. Initial buy at $100, sell order at $110, stop order = 98$(trailingValueIncrement = $2) --> Market value hits $108. then drops to $90. This strategy would have sold at $106. You == Trading God

B. Where this strategy doesn't work so well:

  1. Initial buy at $100, sell order at $110, stop order = 98$(trailingValueIncrement = $2) --> Market value drops to $98, then rises to $110 immediately. You != Trading God as you would have sold at $98. You would have lost $2 + $10

The problem here is that the stop order was too tight. If you used a stop increment of $4 you would have got your full profit but in A.2 you would have lost another $2. Using the correct stop order is key. As far as I lnow the ASR indicator can be used to dermine the correct stop order increment.

This is a semi-automated system so I'm not 100% sure if it belongs in Gekko to be honest.

from gekko.

siergiej avatar siergiej commented on August 27, 2024

More info on stop-loss orders: http://www.investopedia.com/terms/s/stop-lossorder.asp
http://en.wikipedia.org/wiki/Order_(exchange)#Stop_orders

from gekko.

askmike avatar askmike commented on August 27, 2024

It would be extremely simple, I will do this soon or you can send a pull request.

from gekko.

chevdor avatar chevdor commented on August 27, 2024

I like this idea. I need to polish the nma integration then i may havea look at that.

How do you see the config? A fix value? a percentage? Or both, based on the last trade price?

from gekko.

paraghardas avatar paraghardas commented on August 27, 2024

Since u r thinking of stoploss do consider having a trailing stoploss ... which will also protect profit ... you may also let user specify how much trailing stoploss he wish to have.

from gekko.

Kinzowa avatar Kinzowa commented on August 27, 2024

I try to set up Trailing Stop after a new position is open, what is the best solution to achieve this ?

from gekko.

AdityaNayak avatar AdityaNayak commented on August 27, 2024

Were you able to achieve trailing? Would appreciate some direction.

from gekko.

jurepetrovic avatar jurepetrovic commented on August 27, 2024

Hello Gents,

Currently looking at Bitstamp API. These are the possible orders:
BUY LIMIT ORDER
BUY MARKET ORDER
SELL LIMIT ORDER
SELL MARKET ORDER

In their web UI they also support STOP ORDERs with trailing stop.
Do you know any exchange that supports stop orders over the API?

Thanks,
Jure

from gekko.

uipko avatar uipko commented on August 27, 2024

from gekko.

drush avatar drush commented on August 27, 2024

GDAX supports Stop + Stop Limit orders as well.

from gekko.

der-seemann avatar der-seemann commented on August 27, 2024

@laredoza
I'm trying to set up your trailing Stopploss strategy, but have some difficulties.
I don't want it to buy anything, just keep the stopp loss 5% below the highest price. If the market drops below that value, all of my holdings should go short.
Can you or anyone else help me with the correct settings?

from gekko.

laredoza avatar laredoza commented on August 27, 2024

Hi @der-seemann, currently this doesn't support percentage but you can add a value.

trailing Value Increment = 10
initialStopValue = 300
movingStopValue = true
buy = false
buyPrice = 0
sell = false
sellPrice = 0

In this example the initial stop value is $300. If the current value goes to 400 the stop order will become 400 - 10 (trailing Value Increment). If the value goes below $390 all your crypto will be sold.

Please test this on the paper trader as I don't have a pc to test this at the moment. You can of course update the strategy to support percentage.

Make sure you test this properly before using it with real fiat / crypto

from gekko.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.