[SHARE] Simple RSI BULL/BEAR strategy
#28
Added backtest for NEO-USDT.

Began working with an alternative that uses MA for RSI in order to smooth out the values.
So far it really hasn't worked out that great or given any increased benefits but further testing would be needed.

A generic SMA function was written which might be useful for someone:


Code:
var strat = {

    /* your init... */
    init: function() {},

    /* simple moving average (for any values) : returns current average for 'name' */
    sma: function(name, price, points)
    {
        // create arr if not exist + generate array
        if( !this[name] )
               {
            let a = 0,     b = [];
            for (a; a < points; a++) { b[a] = 0; }
            this[name] = b;
        }

        let arr = this[name],
            len = arr.length;

        arr[len] = price; // add new to last in array
        arr.shift(); // remove first (old) from array (keeping max order)        
        this[name] = arr; // set/save

        // calculate current average
        let i = 0,
             total = 0;

        for( i; i < len; i++ ) { total += arr[i]; }
     
        let avg = total / len;
        return avg;
    },

    // your check
    check: function() {}

    // your end
    end: function() {}

}

Just supply it with name, price (candle.close etc) and points (number of points to use).
  Reply


Messages In This Thread
Werkkrew Stoploss - by susitronix - 02-02-2018, 09:39 PM
Removed post - by susitronix - 02-03-2018, 06:49 PM
RE: Share: Simple RSI BULL/BEAR strategy - by tommiehansen - 02-05-2018, 11:38 AM
@Gryphon Confirmation - by mvangoor - 03-22-2019, 11:59 PM
for 3 months - by ankasem - 02-18-2018, 05:30 PM

Forum Jump:


Users browsing this thread: