Added new Strategy RSI_EMACrossover
#1
I am new to GitHub, JavaScript, Bot Trading and this forum.

I appreciate all of the hard work that has gone into this effort and this is my first attempt at a give-back.

I have modified an EMA crossover strategy to incorporate an RSI indicator and it is currently functional and working as designed.

The strategy uses an EMA 3 period and EMA 50 period in conjunction with an RSI 9 period.
If the EMA-3 is above the EMA-50 and the RSI-9 is 60 or higher then we enter a long position (Buy).
If the EMA-50 is above the EMA-3 then we enter a short position (Sell).
I have been live trading it against XRP-USDT on Binance with 15 minute intervals.
It is functioning as designed and holding fairly steady in a sideways market.


https://github.com/TCMabe/Gekko-Share
[url=https://github.com/TCMabe/Gekko-Share][/url]
I am looking for suggestions on how best to share … hopefully this fairly simple tweak of an existing strategy helps someone as new as me …

Thanks !

TC Mabe
  Reply
#2
Awesome stuff! Great start to post it here on the forum for now, you can add more information like backtest results and what markets you are running (real or simulation) this on.
  Reply
#3
(07-12-2018, 05:40 AM)TCMabe Wrote: I am new to GitHub, JavaScript, Bot Trading and this forum.

I appreciate all of the hard work that has gone into this effort and this is my first attempt at a give-back.

I have modified an EMA crossover strategy to incorporate an RSI indicator and it is currently functional and working as designed.

The strategy uses an EMA 3 period and EMA 50 period in conjunction with an RSI 9 period.
If the EMA-3 is above the EMA-50 and the RSI-9 is 60 or higher then we enter a long position (Buy).
If the EMA-50 is above the EMA-3 then we enter a short position (Sell).
I have been live trading it against XRP-USDT on Binance with 15 minute intervals.
It is functioning as designed and holding fairly steady in a sideways market.


https://github.com/TCMabe/Gekko-Share
[url=https://github.com/TCMabe/Gekko-Share][/url]
I am looking for suggestions on how best to share … hopefully this fairly simple tweak of an existing strategy helps someone as new as me …

Thanks !

TC Mabe

Nice, i was looking for something like this as i have gotten caught up in complex strategies but want to go back to simple indicators etc. Thank you for the share i will do some testing and feedback.  One suggestion i would have (not sure how hard it is to do) is to have the rsi high and low as adjustable parameters in the toml file. Just a suggestion to give flexibility.

thanks again.
  Reply
#4

I am on my iPad so this is brutal ... haha ... Great suggestion.


I should have also used a different variable name for the RSI because it’s period value is adjustable. I will modify it when I am back on a computer later.

In the meantime, this should achieve what you are looking for.

In Toml file add:
# rsiHigh
rsiHigh = 60

# rsiLow
rsiLow = 40

In JS file change:

if((shortResult - longResult) >= this.delta && rsi9Result >= 60) {


To:
if((shortResult - longResult) >= this.delta && rsi9Result >=  this.settings.rsiHigh) {



I hope this helps ! Thanks for the feedback !

TC Mabe
  Reply
#5
(07-12-2018, 12:26 PM)TCMabe Wrote:
I am on my iPad so this is brutal ... haha ... Great suggestion.


I should have also used a different variable name for the RSI because it’s period value is adjustable. I will modify it when I am back on a computer later.

In the meantime, this should achieve what you are looking for.

In Toml file add:
# rsiHigh
rsiHigh = 60

# rsiLow
rsiLow = 40

In JS file change:

if((shortResult - longResult) >= this.delta && rsi9Result >= 60) {


To:
if((shortResult - longResult) >= this.delta && rsi9Result >=  this.settings.rsiHigh) {



I hope this helps ! Thanks for the feedback !

TC Mabe

Thank you i will try and make the adjustments later today.

I'm keen to see how this works in papertrading, my only concern is with RSI and EMA you can miss profits at the peak as the start waits form the lines to cross to sell, do you think a trailing stop loss would work with your strat?
  Reply
#6
I agree that the crossover times can miss some opportunities ... especially when running at 15 minutes intervals ...

What I am seeing so far is that it is successfully getting in and out at points that I would be "OK" with.
And it is much better to sleep at night knowing I am minimizing exposure.

I am also contemplating to tighten it up a little bit by changing the EMA-50 to an EMA-10 and then also evaluate the RSI on the exit side ...
EMA-3 lower than EMA-10 would be a pretty quick hairpin exit ... but if the RSI was still in the 50's I might consider staying in for another round.

The EMA-10 being so close to the EMA-3 would "almost" function as a trailing stop-loss, even though it's not the ideal solution as pointed out in another post ...

A true trailing stop-loss would be much better and the code should stay out until the rising conditions triggered another buy signal.

I am planning to write a new version later to include the parameter adjustments we discussed earlier and then to backtest a couple configurations of EMA-3 and EMA-10 respectively.

Thanks again !
  Reply
#7
(07-12-2018, 03:48 PM)TCMabe Wrote: I agree that the crossover times can miss some opportunities ... especially when running at 15 minutes intervals ...

What I am seeing so far is that it is successfully getting in and out at points that I would be "OK" with.
And it is much better to sleep at night knowing I am minimizing exposure.

I am also contemplating to tighten it up a little bit by changing the EMA-50 to an EMA-10 and then also evaluate the RSI on the exit side ...
EMA-3 lower than EMA-10 would be a pretty quick hairpin exit ... but if the RSI was still in the 50's I might consider staying in for another round.

The EMA-10 being so close to the EMA-3 would "almost" function as a trailing stop-loss, even though it's not the ideal solution as pointed out in another post ...

A true trailing stop-loss would be much better and the code should stay out until the rising conditions triggered another buy signal.

I am planning to write a new version later to include the parameter adjustments we discussed earlier and then to backtest a couple configurations of EMA-3 and EMA-10 respectively.

Thanks again !

Your theory of the 3/10 i agree would work as a SL, currently gekko has issues with SL's anyway, happy to help out where i can from a testing perspective, as i mentioned i was looking for this type of strat anyway so anything i can do to help let me know.
  Reply
#8
@TCMabe, stop losses have been written before the link will take you to a trailing stop loss i must admit i have no idea if it works.

https://github.com/xFFFFF/Gekko-Strategi...ingStop.js
  Reply
#9
(07-12-2018, 05:03 PM)Kris191 Wrote: @TCMabe, stop losses have been written before the link will take you to a trailing stop loss i must admit i have no idea if it works.

https://github.com/xFFFFF/Gekko-Strategi...ingStop.js

Thanks, I will take a look later tonight.

In the meantime I have updated the RSI_EMACrossover as discussed.

https://github.com/TCMabe/Gekko-Share

Thanks again !

TC Mabe
  Reply
#10
(07-12-2018, 10:05 PM)TCMabe Wrote:
(07-12-2018, 05:03 PM)Kris191 Wrote: @TCMabe, stop losses have been written before the link will take you to a trailing stop loss i must admit i have no idea if it works.

https://github.com/xFFFFF/Gekko-Strategi...ingStop.js

Thanks, I will take a look later tonight.

In the meantime I have updated the RSI_EMACrossover as discussed.

https://github.com/TCMabe/Gekko-Share

Thanks again !

TC Mabe

Hello,just testing your  strat this morning and i n ow get this error...


Code:
/root/gekko/core/talib.js:45
           throw talibError + paramName + ' needs to be a number';
           ^
Gekko was unable to configure talib indicator:
    optInTimePeriod needs to be a number
Thanks
  Reply


Forum Jump:


Users browsing this thread: