Comments (12)
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:
- Initial buy at $100, sell order at
$110, stop order = 98$ (trailingValueIncrement = $2) --> Market value hits $110. You == Trading God - 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:
- 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.
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.
It would be extremely simple, I will do this soon or you can send a pull request.
from gekko.
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.
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.
I try to set up Trailing Stop after a new position is open, what is the best solution to achieve this ?
from gekko.
Were you able to achieve trailing? Would appreciate some direction.
from gekko.
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.
from gekko.
GDAX supports Stop + Stop Limit orders as well.
from gekko.
@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.
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)
- Ichimoku indicator
- Error with papertrader and tradebot HOT 1
- How to exit from a strategy ? HOT 2
- Binance: can't have BTC as currency and USDT as asset? How to accumulate USDT? HOT 1
- Reconciliation of overlapping datasets HOT 1
- Candle Tick drifts if API fails to return data for X minutes (Kraken) HOT 1
- [Trade Bot Error] Not able to run trade bots with kraken HOT 40
- Access previous EMA HOT 1
- Cant install on windows HOT 3
- Instantly crashing when using data set. (TypeError: done is not a function) HOT 1
- Windows WSL Related Setup HOT 1
- Unable to Import data HOT 1
- TypeError: _.last(...).join is not a function HOT 1
- Original BBRSI HOT 1
- error with new install HOT 2
- Too long Insufficient data available. Age: N of 90 HOT 1
- Cannot trade on coinfalcon HOT 1
- Error: non-error thrown: ERROR: Talib is not enabled HOT 1
- Unable to see the functionality of any page HOT 2
- Sqlite issue, Gekko no finding sqlite on live trader start attempt. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gekko.