Gekko Forum
Potentially Useful Strategy (Inverse Fisher Transform RSI) - 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: Potentially Useful Strategy (Inverse Fisher Transform RSI) (/thread-57224.html)

Pages: 1 2


Potentially Useful Strategy (Inverse Fisher Transform RSI) - lucascostner - 05-29-2018

Hey all- I've had alot of success running gekko live with strategies from this forum and others. I have this indicator that I think could be made into a profitable strategy from tradingview- It's just a few lines of code but I'm not sure how to get it up and going in Gekko. I think that the built in RSI strategy in Gekko could easily be adapted into this by someone with a little more programming knowledge than I have. It's just a few short lines of code. If anyone can help get it up and running I will do some backtesting and run genetic algorithms to find some profitable settings and share them here. 


//
// @author LazyBear
// If you use this code in its orignal/modified form, do drop me a note. 
// 
study("Inverse Fisher Transform RSI [LazyBear]", shorttitle="IFTRSI_LB")
s=close
length=input(14, "RSI length")
lengthwma=input(9, title="Smoothing length")

calc_ifish(series, lengthwma) =>
    v1=0.1*(series-50)
    v2=wma(v1,lengthwma)
    ifish=(exp(2*v2)-1)/(exp(2*v2)+1)
    ifish

plot(calc_ifish(rsi(s, length), lengthwma), color=orange, linewidth=2)
hline(0.5, color=red)
hline(-0.5, color=green)


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - crypto49er - 05-29-2018

This looks interesting. So how does it work? Do you buy when it crosses over the green dotted line and sell when it goes past the red dotted line and goes below it?

What happens when it crosses the green dotted line but falters and never reaches the red dotted line? Does it sell when it falls back pass the green dotted line and considers that as a "stop loss"?

Also, I'm trying to think which indicator to make this strategy work? I never heard of the "Inverse Fisher Transform RSI". Based on the graph output in TradingView, it looks similar to MACD in terms of the range (+0.5, 0, -0.5), but I'm guessing we need to create our own indicator to make this work. So it looks to me that we need to create the indicator, and then the strategy. I have written a few strategies, but never my own indicator, would be an interesting challenge.


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - lucascostner - 05-30-2018

Yeah you would want to buy under the bottom line and sell over the top line. I imagine if we got this up and running there would be times when it dipped back below the buy line without triggering a sell, in which case it would probably just hold until it eventually crossed into the sell signal. You can see some visualizations here which will make it very easy to see how it works--

https://www.tradingview.com/script/8OxW1SF4-3-more-indicators-Inverse-Fisher-on-RSI-MFI-and-CyberCycle/

It's just a simple calculation applied to RSI and we already have a strategy for that so it shouldn't be terribly difficult for someone who has developed these strategies before. I would probably experiment with adding stop loss and tweaking the parameters to really maximize profit. 

If you wanted to get really fancy, the best idea would be to start watching once it crosses the buy line and then try to buy when the price changes direction. Ideally you would want to do the same thing once it crosses the sell line, keep watching as long as the price is going up and then sell when the price reverses. 

I got this strategy months ago from someone on a forum who _claimed_ to have made MASSIVE amounts of money using it. However they didn't have a way to automate it, they were just sitting there with alerts set up on trading view for tons of coins so they could get in and out of trades using the process described above. I think it might be a pretty cool project to try to automate for those of us that actually have a live and can't daytrade 12 hours a day 7 days a week.


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - Femistoklov - 11-11-2018

(05-29-2018, 08:24 PM)lucascostner Wrote: I've had alot of success running gekko live with strategies from this forum and others.

How did you this? I'm trying strategies from here https://github.com/xFFFFF/Gekko-Strategies, and all of them seem to be non-profitable even on backtesting.


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - Remo - 11-11-2018

Hi 
Probably late but i managed to modify mark.sch`s indicator and get it to work like this.He did the hard work.I just modified it :Smile
Thx to him
Here is the indicator:
copy this into /indicators/IFTRSI.js   
Code:
var RSI = require('./RSI.js');
var WMA = require('./WMA.js');

var Indicator = function(config) {
 this.result = false;
 this.rsiInterval = config.interval;
 this.wmaLength = config.length;
 this.rsi = new RSI({interval: this.rsiInterval});
this.wma = new WMA({length: this.wmaLength});
}

Indicator.prototype.update = function (candle) {
 this.rsi.update(candle);
 if (this.rsi.result) {
   let v1 = 0.1 * (this.rsi.result - 50);
   this.wma.update(v1);

   if (this.wma.result) {
       this.result = (Math.exp(2 * this.wma.result)-1) / (Math.exp(2 * this.wma.result)+1);
   }
 }
}

module.exports = Indicator;


 Then copy this to /indicators/WMA.js
Code:
var Indicator = function(settings) {
   this.input = 'price';
   this.windowLength = settings.length;
   this.prices = [];
   this.result = 0;
   this.age = 0;
   this.sum = 0;
}

Indicator.prototype.update = function(price) {
   var tail = this.prices[this.age] || 0;
   this.prices.push(price);


   var psum =0;
   var pdiv = 0;

   for (var j=0;j<this.prices.length;j++)
   {

       psum += j * this.prices[j];
       pdiv += j;

   }

   this.result = psum/pdiv;
   if (this.prices.length > this.windowLength)
   {
       this.prices.shift()

   }

   this.age = (this.age + 1) % this.windowLength
}

module.exports = Indicator;
Then you create it in your strat with:

var iftrsiParameters = {rsiInterval: 14, wmaLength: 8};
this.addIndicator('iftrsi', 'IFTRSI', iftrsiParameters);

And update it in:

strat.update = function(candle) {
this.indicators.iftrsi.update(candle);
}

Later use it with:

this.indicators.iftrsi.result

Hope this helps Smile
GL


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - Gryphon - 11-12-2018

This looks interesting Smile Thanks for sharing.


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - barrubba - 11-21-2018

starting from your words:
Then you create it in your strat with:...
i don't understand last info to use strat...
there is a repo git with instructions?
have you some backtest result?

found here and many other site that is a very profitable indicator
https://www.tradingview.com/script/8OxW1SF4-3-more-indicators-Inverse-Fisher-on-RSI-MFI-and-CyberCycle/


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - lucascostner - 11-24-2018

Hey Remo- Lucas Costner here, thanks for getting this together for me! I started this thread a few months ago and had forgotten about it. Would it be possible for you to share your strategy file as well? I'm not to good at writing custom strategies and it will take me forever to figure out how to call this in the strategy file. Or if Remo isn't around maybe one of the other experienced gekko users could chime in. I'm sure for someone with more coding experience than me it probably pretty self evident how to write a simple strategy to use the indicators you added but it'll take me weeks to figure out!


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - lucascostner - 11-26-2018

Well I’m working on getting a strategy file together but getting nothing but error because I’m no good at this. Maybe someone could point me to one of the default strategies I could modify and get this working by doing a few copy and pastes?


RE: Potentially Useful Strategy (Inverse Fisher Transform RSI) - Remo - 11-26-2018

Code:
var strat = {};
var traded = false;
var IFTRSI = require('./indicators/IFTRSI.js');
strat.init = function() {
    var iftrsiParameters = {rsiInterval: 14, wmaLength: 8};
    this.addIndicator('iftrsi', 'IFTRSI', iftrsiParameters);
    
}
strat.update = function(candle) {
    this.indicators.iftrsi.update(candle);
 
}
strat.check = function(candle) {
    var iftResult = this.indicators.iftrsi.result;

if ( traded == false && iftResult < -0.5 ){
    this.advice('long')
    traded = true;
    console.log(iftResult);
}else if(traded == true && iftResult > 0.5 ){
    this.advice('short')
    console.log(iftResult);
    traded = false;
}
}


module.exports = strat;
This is most simplest way.