RSI = 0 first view candles
#1
I have a simple rsi script which buys at rsi below 30 en buy at rsi above 70


Every candle which it checks it also prints out the RSI value

See the attachment. why are the first rsi value 0 ?

Code:
// Let's create our own strategy
var strat = {};

var RSIinterval = 14;
var RSIlow = 30;
var RSIhigh = 70;


strat.init = function() {

this.addIndicator('rsi', 'RSI', { interval: RSIinterval });    

}

// What happens on every new candle?
strat.update = function(candle) {
 // your code!
}

// For debugging purposes.
strat.log = function() {
 // your code!
}

// Based on the newly calculated
// information, check if we should
// update or not.
strat.check = function(candle) {

var RSI = this.indicators.rsi.result;
var RSIsaysSELL = RSI > RSIhigh;
var RSIsaysBUY = RSI < RSIlow;  
   console.log(RSI)    
   
   
   if (RSIsaysBUY)
   {
       this.advice('long')
   }    
   

if (RSIsaysSELL)
   {
     
    this.advice('short')
   
   }    
}

strat.end = function() {
 // your code!
}

module.exports = strat;


Attached Files
.png   Knipsel.PNG (Size: 56.62 KB / Downloads: 5)
  Reply


Messages In This Thread
RSI = 0 first view candles - by PrimalFury - 09-23-2018, 04:23 PM
RE: RSI = 0 first view candles - by cubit - 09-23-2018, 07:55 PM
RE: RSI = 0 first view candles - by PrimalFury - 09-23-2018, 08:17 PM
RE: RSI = 0 first view candles - by cubit - 09-23-2018, 08:28 PM
RE: RSI = 0 first view candles - by cubit - 09-23-2018, 08:30 PM
RE: RSI = 0 first view candles - by mark.sch - 09-24-2018, 07:40 AM

Forum Jump:


Users browsing this thread: