Gekko Forum
[SHARE] Simple RSI BULL/BEAR strategy - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Strategy Development (https://forum.gekko.wizb.it/forum-12.html)
+--- Thread: [SHARE] Simple RSI BULL/BEAR strategy (/thread-100.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38


RE: [SHARE] Simple RSI BULL/BEAR strategy - i00ney - 04-10-2018

Anybody also noticed that there seems to be an offset with the RBBA strat between the backtest results and the paper trading/live trading?
For instance when using BTC/TRX pair with 5 min candle at Binance I had to offset, at the Gekko config, the tuned values as mentioned below (actually tuned values minus value below):

Param               Offset
BULL_RSI_high   +2
BULL_RSI_low    -2
BEAR_RSI value  -1
BEAR_RSI_high   +2
BEAR_RSI_low    -2

When comparing the paper/live trading results and using this offset, it than seems to be aligned with the Tradeview RBBA version and within Gekko backtest itself.

I didn't verified (yet) other candle sizes and/or strategies but I am curiuos if there is also an offset present..

So the big question is why is there a deviation/offset between the backtest results and the paper/live trading results and.. more important how to cancel out the offset without setting the offset manually at the config?


RE: [SHARE] Simple RSI BULL/BEAR strategy - tommiehansen - 04-10-2018

(04-10-2018, 12:47 AM)richard Wrote:
(04-09-2018, 10:17 AM)tommiehansen Wrote: If you would have read the thread you would have seen that several attempts at stoplosses has already been made. None have been successful
and this for quite obvious reasons if one would care to understand the underlying code. There are however versions with stoplosses floating around, feel free to download those or even better -- contribute by adding it yourself.

Yes, I did read the whole thread.  That's why I said what I did.  I saw that you had tested and rejected stop losses.

I'm trying to suggest that better metrics for testing and scoring results may be helpful.

Most importantly, I think the 'Simulated Profit' number is leading you astray.  It creates a level of excitement and a view of the results that is dangerous and counter-productive.

Let's say you back-test using a year's worth of historical data.  And you fine-tune until you have a nice large 'Profit' showing.  If you start trading live, and the market perfectly repeats itself you're going to be laughing all the way to the bank!  But that's simply never going to happen.

There are so many ways of looking at this.  Consider the big chart view of the whole year.  That's the best information we have, okay.  But what about those sections of that year that your system didn't handle very well?  What if that's what the market hands you when you first start trading live?  (Assuming the future actually mirrors the past in some way.)

What if the market repeats several of your back-test's worst weeks in a row?  Will you still have an account to trade?  Or will you lose everything?

Optimizing for a large period of time and ignoring strings of draw-downs within it because the final 'Profit'  is as big as you can get it is probably not a very good idea.


If we're lucky the market will replay some of the days or weeks from our historical data.  Maybe not.  But if we ignore or downplay some of those periods, assuming or hoping they won't bite us at the wrong time is probably not a good idea.

Trading, like running a profitable casino, is a probability game.  You try to keep the numbers in your favor.  And manage your risk according to your assets.

If you have a large draw-down at the wrong time it could potentially knock you out of the game entirely.  Or at least make your eventual success much more difficult.

I don't know the best way to do this.  But looking carefully at the worst weeks or months in your year of backtesting seems very important.  Unless you're feeling lucky.  :-(

This is just one way of looking at the problem.  There are many others.

Trading without a stop-loss, especially in automated trading, seems too much like wishing upon a star.

That's my opinion, which I'm sharing with you because I appreciate your point of view and I want you to do well.

A classical stop-loss is one of many ways to control your losses.  My intent was to draw attention to those losses more than to suggest a specific solution.

Should I actually come up with a strategy that seems viable I will share it.  I've written automated trading systems in the past and managed to break even, which isn't nearly good enough.  I made mistakes.  I'm trying to learn from them.

Your strategies seem close to perfect.  They seem workable in every market you can apply them to.  It's the tuning that may need some adjusting.  It's a tricky endeavor maximizing profits and minimizing losses in a future market that's bound to be different from the past.  There is no guarantee of success.  At least not without access to a time machine. :-)  (Anyone have data for 2019?)

Thanks very much for your efforts.

Richard

I, note I,  know much of this but this thread simply is not about market theory or backtesting theory as the topic clearly suggest.
You seem to read a bit too much into the samples and me not taking the time discuss things which are off-topic to this thread. The samples are samples, they are strictly backtests and no more or less then that.

It's up to the user(s) to decide and theorize, to have poor judgement or not, to be educated or not -- these strategies, like any other strategy, doesn't do any of that just like a results of a backtest doesn't care how the user interprets the results.

I do agree that there's generally problematic view regarding backtests and metrics though, but as said -- it's off-topic (and it's a huge and complex topic as well, if we were to discuss it the entire thread would become filled with such posts).


RE: [SHARE] Simple RSI BULL/BEAR strategy - cena3 - 04-10-2018

(01-31-2018, 07:53 PM)tommiehansen Wrote: The general idea is quite simple: RSI between A and B works best in trend C but workes less great in trend D. So... use that knowledge to do A when B and C when D.

Works best with shorter duration candles in the ranges of 5-30 minutes but this of course depends on the pair. Please do your own backtests and please do not expect the default settings to always work.

This strategy has two variations, one simply called "RSI BULL/BEAR" and a modification called "RSI BULL/BEAR ADX". The latter is an improvement and most often yields better results since it adds logic to modify the RSI params when more rapid changes are detected using ADX (https://tulipindicators.org/adx). A simple way to test the strategy is to begin with the original (since it's faster because less params) and then use the ADX-version to improve upon the results.


---

Backtest samples


XRP-USDT, dec 2017 - jan 31 2018
https://i.imgur.com/4bcYnNm.png

XRP-USDT, 2016-10-15 - 2018-01-21
https://i.imgur.com/ZoUfeaT.png

ETH-USDT: 2016-01-01 - 2017-10-05
https://i.imgur.com/Yz0t4VN.png

NEO-USDT: 2017-12-01 - 2018-02-03
https://i.imgur.com/rqHjgyM.png

Note: These are only samples, one can of course yield better results with other parameters.
In some cases one can even create backtests results that has quite insane returns and makes
the above backtests look bad.


---

Instructions for use

1. Clone the repo:
git clone https://github.com/tommiehansen/gekko_tools.git
...or just download it from https://github.com/tommiehansen/gekko_tools

2. Copy JS-files e.g. RSI_BULL_BEAR.js to /gekko/strategies
3. Copy TOML-files e.g. RSI_BULL_BEAR.toml to /gekko/config/strategies
-
4. Versions after the 18th of march of the strategies also requires custom indicators, get here:
https://github.com/Gab0/gekko-extra-indicators
5. ...and add to gekko/strategies/indicators.


Running it live
Make sure Gekko downloads the necessary data needed. Else the strategy will be stuck in 'BEAR'-mode and won't trade.
Your Warmup period should reflect what you have set as SMA_long since the strategy will need that length of data in order to properly see if there's a BULL or BEAR trend.
Also make sure Gekko (check your console) tells you that it is downloading the necessary data before it starts running, you should get a message about this.

---

Q&A


Q: Adding a stoploss would be great
A: No, this has been tested several times and always gives less performance for quite obvious reasons.
-
Q: It did a bad trade
A: Yes, none of this strategies manages to always make good trades.
-
Q: When running live it does nothing
A: See 'Runing it live'
-
Q: It doesn't work
A: This is unrelated to the strategies, try another forum thread
-
Q: Using X instead of Y would be better
A: Maybe? Modify the strategy and share the results!

---

Download / latest versions

To get the latest versions goto (and modifications):
https://github.com/tommiehansen/gekko_tools/tree/master/strategies

...or just clone on your drive somewhere:
git clone https://github.com/tommiehansen/gekko_tools.git



RE: [SHARE] Simple RSI BULL/BEAR strategy - cena3 - 04-10-2018

hi , 

how does the order come out bot a buy and a seller ?? and that he does nothing?


RE: [SHARE] Simple RSI BULL/BEAR strategy - jvs - 04-13-2018

Might I suggest that someone writes into the strategy a stop loss that follows these rules:

if the LAST signal from RSIBB was BUY
and the CURRENT signal from RSIBB is BUY
and the CURRENT price is LESS than the STOPLOSS (Eg: Buy price - 5%)
THEN OVERWRITE the CURRENT signal to SELL

That means that the script will execute a stop loss while:
The price is lower than the stoploss and the RSIBB signal is buy

IF the stoploss is active, and RSIBB changes its own signal from buy to sell... then the stoploss gets "reset".

If the price climbs back up again to go above the stoploss, and the signal from RSIBB is *still* buy, then the script will buy.


I'm guessing that previously others have tested a stop loss where once it's hit, then the asset is sold and that's it. The above strategy will buy back again if the price rises backup, so it's still following the RSIBB strategy, just with a smart stoploss.

One could further it I guess by setting a trailing stop or even a take profit.

I've tested the above strategy and the results speak for themselves...I'll let you guys find out Smile I would honestly do it, but I don't know the quirks and ins and outs of gekko and javascript well enough to do it myself sorry.


RE: [SHARE] Simple RSI BULL/BEAR strategy - Henry151 - 04-13-2018

Just out of curiosity -- how many of you, or are any of you, running this strategy and finding it profitable, with live trading?


RE: [SHARE] Simple RSI BULL/BEAR strategy - richard - 04-18-2018

(04-13-2018, 09:17 PM)Henry151 Wrote: Just out of curiosity -- how many of you, or are any of you, running this strategy and finding it profitable, with live trading?

Hopefully not many.

Gekko is impressive in some ways.  But it's really not ready for prime time.


Edit: No wonder stop losses don't work. You have no access to current price.


RE: [SHARE] Simple RSI BULL/BEAR strategy - ankasem - 04-18-2018

@richard
@Henry151


what you have here  ?

to make fun of.
hang on facebook..


RE: [SHARE] Simple RSI BULL/BEAR strategy - Asemaniko - 04-18-2018

Thank You Best Strategy -Live Runner 

https://hizliresim.com/oO1a82

https://hizliresim.com/dORaZL


RE: [SHARE] Simple RSI BULL/BEAR strategy - jvs - 04-20-2018

(04-13-2018, 03:13 AM)jvs Wrote: Might I suggest that someone writes into the strategy a stop loss that follows these rules:

if the LAST signal from RSIBB was BUY
and the CURRENT signal from RSIBB is BUY
and the CURRENT price is LESS than the STOPLOSS (Eg: Buy price - 5%)
THEN OVERWRITE the CURRENT signal to SELL

That means that the script will execute a stop loss while:
The price is lower than the stoploss and the RSIBB signal is buy

IF the stoploss is active, and RSIBB changes its own signal from buy to sell... then the stoploss gets "reset".

If the price climbs back up again to go above the stoploss, and the signal from RSIBB is *still* buy, then the script will buy.


I'm guessing that previously others have tested a stop loss where once it's hit, then the asset is sold and that's it. The above strategy will buy back again if the price rises backup, so it's still following the RSIBB strategy, just with a smart stoploss.

One could further it I guess by setting a trailing stop or even a take profit.

I've tested the above strategy and the results speak for themselves...I'll let you guys find out Smile I would honestly do it, but I don't know the quirks and ins and outs of gekko and javascript well enough to do it myself sorry.


Hmm...tail between my legs. When I put this into my script, it had massive results. Too good to be true.

Alas, it was. The way I had implemented it allowed the script to time travel and go back and remove buy orders, so the returns were so so wrong.

As per previous comments in the thread - stop losses don't garner any gain using this strategy. ah well, back to the drawing board!