<p>use <code>Current Gain = (Price at 05:05) - (Price at 05:00)</code></p>

<p>so at 05:59 it should be almost exactly as the new level at 06:00  </p>

CC BY-SA 4.0
2018-08-09T06:01:32.350Z
2018-08-09T06:01:32.350Z
jaybny
<p>I am working on a trading bot that computes values for several indicators including the RSI. I subscribe to real time minute-level market data from an exchanges, and as new data arrives, I get the most recent tick, and re-compute indicators. 
Let's assume the RSI calculation period is 1 hour. </p>

<p>Average gain is computed as:</p>

<p><code>05:00</code> as <code>[Prev Avg Gain x 13 + (Price at 05:00 - Price 04:00)]/14</code>. </p>

<p><code>06:00</code> as <code>[Prev Avg Gain x 13 + (Price at 06:00 - Price 05:00)]/14</code>. </p>

<p>What is the right way to compute RSI at a minute level? I generate trade signals (buy/sell) every 5 minutes. What is the right way to update RSI at <code>05:05</code> i.e, at a smaller granular period (5 minutes) than the calculation period (1 hour)? I don't want to wait one until <code>06:00</code> to get the RSI for the one hour period. I have two options:</p>

<p>Compute <code>Current Gain = (Price at 05:05) - (Price at 05:00)</code>.</p>

<p>OR</p>

<p>Compute <code>Current Gain = (Price at 05:05) - (Price at 04:05)</code>. 
And do this for each of the previous intervals so that average gain also follows this formula - essentially adding a 5 minute shift to each computation.</p>

<p>Any suggestions are welcome.</p>

CC BY-SA 4.0
2018-08-08T23:50:09.677Z
What does RSI stand for?
Pieter Wuille
CC BY-SA 4.0
2018-08-08T23:52:54.860Z
Are you referring to Relative Strength Index? https://en.wikipedia.org/wiki/Relative_strength_index
JBaczuk
CC BY-SA 4.0
2018-08-09T05:31:03.650Z
Yes I am! Sorry, should have been clearer.
badbot
<exchanges><api><trading><historical-trade-data><bots>
What is the right method to calculate Relative Strength Index (RSI) for incoming real time data?
badbot
# What is the right method to calculate Relative Strength Index (RSI) for incoming real time data?

(Asked by: username_0 on 2018-08-08)

I am working on a trading bot that computes values for several indicators including the RSI. I subscribe to real time minute-level market data from an exchanges, and as new data arrives, I get the most recent tick, and re-compute indicators.
Let's assume the RSI calculation period is 1 hour.

Average gain is computed as:

`05:00` as `[Prev Avg Gain x 13 + (Price at 05:00 - Price 04:00)]/14`.

`06:00` as `[Prev Avg Gain x 13 + (Price at 06:00 - Price 05:00)]/14`.

What is the right way to compute RSI at a minute level? I generate trade signals (buy/sell) every 5 minutes. What is the right way to update RSI at `05:05` i.e, at a smaller granular period (5 minutes) than the calculation period (1 hour)? I don't want to wait one until `06:00` to get the RSI for the one hour period. I have two options:

Compute `Current Gain = (Price at 05:05) - (Price at 05:00)`.

OR

Compute `Current Gain = (Price at 05:05) - (Price at 04:05)`.
And do this for each of the previous intervals so that average gain also follows this formula - essentially adding a 5 minute shift to each computation.

Any suggestions are welcome.

**Tags:** exchanges, api, trading, historical-trade-data, bots

> **Comments:**
> **username_1**: What does RSI stand for?  
> **username_2**: Are you referring to Relative Strength Index? https://en.wikipedia.org/wiki/Relative_strength_index  
> **username_0**: Yes I am! Sorry, should have been clearer.  

---

## 1 answers

### Answer by username_3 on 2018-08-09. Score: 0

use `Current Gain = (Price at 05:05) - (Price at 05:00)`

so at 05:59 it should be almost exactly as the new level at 06:00


---

