Sie sind auf Seite 1von 7

5/27/2018 [SHARE] Simple RSI BULL/BEAR strategy

Login Register Portal Forums Search Member List Calendar Help

View New Posts View Today's Posts

Gekko Forum   ›   Gekko   ›   Strategy Development    ›   [SHARE] Simple RSI BULL/BEAR strategy 

Pages (30):  1 2 3 4 5 ... 30 Next »   

[SHARE] Simple RSI BULL/BEAR strategy

tommiehansen Joined: Jan 2018


Member Posts: 197
Reputation: 24

  01-31-2018, 07:53 PM (This post was last modi ed: 03-25-2018, 11:42 PM by tommiehansen. Edit Reason: removed copy-paste js/toml- les, changed instruction to clone from repo #1
instead )

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 modi cation 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.

https://forum.gekko.wizb.it/thread-100.html 1/7
5/27/2018 [SHARE] Simple RSI BULL/BEAR strategy

---

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- les e.g. RSI_BULL_BEAR.js to /gekko/strategies


3. Copy TOML- les e.g. RSI_BULL_BEAR.toml to /gekko/con g/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 re ect 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 modi cations):


https://github.com/tommiehansen/gekko_to...strategies

...or just clone on your drive somewhere:


git clone https://github.com/tommiehansen/gekko_tools.git

  Reply

susitronix Joined: Jan 2018


Member Posts: 165
Reputation: 12

01-31-2018, 09:30 PM (This post was last modi ed: 01-31-2018, 10:07 PM by susitronix.) #2

https://forum.gekko.wizb.it/thread-100.html 2/7
5/27/2018 [SHARE] Simple RSI BULL/BEAR strategy

wow this looks GOOD.


Thanks alot for sharing. Will try it. nice!!!

Works a treat!
Only tested with BTC/Usdt 15min 2month/Binance.
Not the right setting but the Buy/Sell signal looks superPromising THANKS!
impressive structure.

  Reply

tommiehansen Joined: Jan 2018


Member Posts: 197
Reputation: 24

02-01-2018, 01:13 AM (This post was last modi ed: 02-01-2018, 01:15 AM by tommiehansen.) #3

susitronix Wrote:  (01­31­2018, 09:30 PM)

wow this looks GOOD.


Thanks alot for sharing. Will try it. nice!!!

Works a treat!
Only tested with BTC/Usdt 15min 2month/Binance.
Not the right setting but the Buy/Sell signal looks superPromising THANKS!
impressive structure.

For BTC or higher valued coins you'd want di erent timings and settings as you say. BTC, eventhough crypto, is a bit more stable then say
XRP and 'smaller' coins.

But here's a 10-month backtest using BTC:


https://i.imgur.com/HWkurC1.png

When backtesting against BTC you'd also have to remember that you'd be backtesting against all other bots and strategies that people
use as well. :-)

  Reply

susitronix Joined: Jan 2018


Member Posts: 165
Reputation: 12

02-01-2018, 01:16 AM (This post was last modi ed: 02-01-2018, 01:36 AM by susitronix.) #4

That Code of yours is astonishing!


Its so direct and nice structurized.

With a few Backtesting on:


Usdt/Neo
Usdt/Btc

Result very satisfying allready.


Works best with 11 minutes Candles.
Looks like the Daytrader i was looking for.

Only downside:
if at the Bull Trend the last Trade was a Buy, 
then, when entering the Bear Trend, it would keep the Bag maybe because of the "BullTrend.WaitState"?

https://forum.gekko.wizb.it/thread-100.html 3/7
5/27/2018 [SHARE] Simple RSI BULL/BEAR strategy

You obviously must be one of the smart guys but kind enough to share with us... Thanks

Looks good

But thats the most impressive Part that it allready begin to work a treat by only change to 11 minutes Candles.
Imagine what a proper Optimatisation could do!

This clearly proves for me that the code of yours works.

The Importer is not nished Download otherwise i will try Stoploss like so:

Code:

   // BEAR TREND


   if( maFast < maSlow )
   {
        // in case before Trendreversal the last trade, is a buy?
        if( this.advice == 'long');
        {    
        // get rid of the BAG
            this.advice ('short');
        }    
       log.debug('BEAR Trend');
       rsi = ind.BEAR_RSI.result.result;

  Reply

tommiehansen Joined: Jan 2018


Member Posts: 197
Reputation: 24

02-01-2018, 02:11 AM (This post was last modi ed: 02-01-2018, 02:14 AM by tommiehansen.) #5

Yes, it will 'keep the bag' as you say and that's one of the things one would want to x since a reversal in the trend would be a quite clear
sign that it would be time to accept a loss.

I tested it now though and that simple thing does not really do much except hurt the strategy. What ends up happening is that the
strategy sells and then buys again since the MA comes close to the RSI-buy at the BEAR trend. One can clearly see this since some time
periods becomes only 1 candle long. That isn't always awful but the short tests i did it hurt more then it gave pro ts.

Here's the code that i used:

Code:

    // BEAR TREND


    if( maFast < maSlow )
    {
        // check if it's a trend reversal
        if( this.trend.adviced && this.trend.direction == 'up' )
        {
            this.advice('short'); // drop dead weight
        }
        
        log.debug('BEAR Trend');
        rsi = ind.BEAR_RSI.result.result;

Could do with more re nments and having a reversal ofc will make it possible to adjust all other values as well. Would need to be
backtested on a larger amount of data as well.

This rst thing was just a sort of baseline idea. :-)



Note: I would also wait until the bugs regarding the TULIP indicators gets properly x since they might give some bad data at the moment,
https://forum.gekko.wizb.it/thread-100.html 4/7
5/27/2018 [SHARE] Simple RSI BULL/BEAR strategy
see:
https://github.com/askmike/gekko/issues/1827

This strategy will still work since the idea is sound in itself but the speci c parameters would probably need to be modi ed.

  Reply

susitronix Joined: Jan 2018


Member Posts: 165
Reputation: 12

02-01-2018, 02:21 AM #6

TESTED:
Binance USDT/ETH
1month
14 minutes Candles
with your Strat makes 67%
my addition does not work make only 59%

Maybe i would need to compare the lastBuyPrice from the portofolioManager,


to set a dynamic Stoploss

  Reply

tommiehansen Joined: Jan 2018


Member Posts: 197
Reputation: 24

02-01-2018, 03:02 AM (This post was last modi ed: 02-01-2018, 03:03 AM by tommiehansen.) #7

What you're looking for is basically a trailing stoploss. I have no idea how to implement that in Gekko but if i were to code it in pure js i
would just set this trail (which would consist of the current price) everytime a long position is taken and then check it on every candle etc.
The logic is quite basic.

Doesn't need to be that fancy, just needs this:


1. A new option in the TOML- le so that it can be con gured
2. It need to be percentage based (since anything else would be awful); so need to calc percentage between current price and old price
(trail)
3. If executed the rest of the stu should obviously stop until next candle (at least)

Edit: Tried that other trail with USD-BTC-data at 1 year and 8 months @ 11 min but my Gekko is just crashing with that amount of data.
Edit 2: You really need to test with more data when you test. 1 month is hardly enough. :-)

  Reply

susitronix Joined: Jan 2018


Member Posts: 165
Reputation: 12

02-01-2018, 05:55 PM #8

https://forum.gekko.wizb.it/thread-100.html 5/7
5/27/2018 [SHARE] Simple RSI BULL/BEAR strategy

Thanks for the Hint.


I am just new to write code sorry. So i begun with notepad++ but fund that i must use Java JDK.
..and learn a bit more
Guess the jdk will help me implement the
/plugins/trader/portofolioManager //var price

First ill test your strat properly, and give it a try.


Looking for the Tulip-issue.

  Reply

susitronix Joined: Jan 2018


Member Posts: 165
Reputation: 12

02-01-2018, 10:23 PM #9

I like your idea of TrendDirection. just a busy day

Found Stoploss article by Werkkrew:

Emit Trade to Strategy #1810


https://github.com/askmike/gekko/pull/1810

  Reply

tommiehansen Joined: Jan 2018


Member Posts: 197
Reputation: 24

02-02-2018, 08:21 AM #10

That is in some sort of beta it would seem. Do note that the original strategy has a sort of stop-loss though since in trend reversel the RSI
High gets a lower value meaning a sell will be triggered at a lower level.

  Reply

Pages (30):  1 2 3 4 5 ... 30 Next »   

Subscribe to this thread


Forum Jump: -- Strategy Development Go
View a Printable Version

Users browsing this thread:

Disclaimer Other sites Forum


Navigation
We are an educational forum for analysing, Project
learning & discussing general and generic Homepage Forums
information related to cryptocurrencies and Github Repo Portal
trading strategies. No content on the site
Discord Channel Search
constitutes - or should be understood as
constituting - a recommendation to enter in Gekko releases Help 
any securities transactions or to engage in Show Team

https://forum.gekko.wizb.it/thread-100.html 6/7
5/27/2018 [SHARE] Simple RSI BULL/BEAR strategy
any of the investment strategies presented in
our site content.

https://forum.gekko.wizb.it/thread-100.html 7/7