title: What is correct configuration of input parameters for calculating RSI (and ROC)
body: <p>I have tried to use <a href="https://github.com/anandanand84/technicalindicators" rel="nofollow noreferrer">Technical Indicators library</a> to calculate <code>RSI</code> (and <code>ROC</code>) for candlestick's closing prices, but when I compare results from <a href="https://www.binance.com/en" rel="nofollow noreferrer">Binance</a>, I am not getting quite accurate results:</p>
  <p>I fetch data using this <a href="https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data" rel="nofollow noreferrer">Binance API</a>:</p>
  <p>This is example of usage for <a href="https://runkit.com/anandaravindan/rsi" rel="nofollow noreferrer">RSI</a> and <a href="https://runkit.com/anandaravindan/roc" rel="nofollow noreferrer">ROC</a> indicators:</p>
  <p>If I do this:</p>
  <pre><code>let inputData = {
          values: data, // 15 candlesticks, 1m candlestick data, values[0] is oldest closing price
          period: 14,
        };
  </code></pre>
  <p>and I do calculation:</p>
  <pre><code>const results_rsi = RSI.calculate(inputData);
  </code></pre>
  <p>I get single element array, with quite <strong>inaccurate</strong> result in compare to (realtime) data on Binance.</p>
  <p>If I do this:</p>
  <pre><code>let inputData = {
          values: data, // 100 candlesticks, 1m candlestick data, values[0] is oldest closing price
          period: 14,
        };
  
   const results_rsi = RSI.calculate(inputData);
  </code></pre>
  <p>I get a result with a bunch of elements, and if I compare <code>result_rsi</code>'s <strong>last</strong> element with Binance <code>RSI 14 (1m)</code> I get actually very <strong>accurate</strong> result. Also, I have read in one of the <a href="https://github.com/anandanand84/technicalindicators/issues/249" rel="nofollow noreferrer">git issues</a> that providing more historical data is better.</p>
  <p>Now, so far so good... Or at least that is what I thought :) However, both RSI and ROC results were very accurate.</p>
  <p>The thing is, when I applied same logic, but with different parameters, say like this:</p>
  <pre><code>let inputData = {
          values: data, // 100(or even 200 and 500) candlesticks, 1h candlestick data, values[0] is oldest closing price
          period: 30,
        };
  
         const results_rsi = RSI.calculate(inputData);
        const results_roc = ROC.calculate(inputData);
  </code></pre>
  <p>and I check last element of <code>results_rsi</code> and <code>results_roc</code> (which I consider that are actual results, but maybe not?), I am still getting quite good results for <code>RSI</code>, but for <code>ROC</code> I am getting very wrong results. It makes me think if I even use this library correctly, and I am not quite sure if even <code>RSI</code> results are correct, cause I didn't try it with many different parameters / data.</p>
  <p>So, the questions :</p>
  <p>(from docs):</p>
  <pre><code>var data = 
  [11045.27,11167.32,11008.61,11151.83,10926.77,10868.12,10520.32,10380.43,10785.14,10748.26,10896.91,10782.95,10620.16,10625.83,10510.95,10444.37,10068.01,10193.39,10066.57,10043.75];
  
  var period = 12;
          
  var expectResult = [-3.85,-4.85,-4.52,-6.34,-7.86,-6.21,-4.31,-3.24];
      
  ROC.calculate({period : period, values : data});
  </code></pre>
  <ol>
  <li>What is the actual result of ROC here? Cause the array is returned.</li>
  <li>How input values should be sorted? (what should be the <code>values[0]</code>)?</li>
  <li>Where am I wrong? :D</li>
  </ol>