Plot the SMA over the RSI based on the RSI data

Chaklader

Member
Joined
Feb 23, 2021
Posts
6
Likes
0
I would like to plot the SMA using the RSI data over it. How do I accomplish it?
 

Pejman

Well-known member
Joined
May 22, 2019
Posts
82
Likes
17
It is easy, right click on RSI study > add overlay > Moving Average and SMA and done ,
 

Shtick Hustler

Well-known member
Joined
Oct 15, 2020
Posts
103
Likes
44
Grab the MW default studies here:
MotiveWaveStudies113020.zip

The RSI.java study is in it.

You'll have to extract the code out of the RSI study that calculates RSI and place it in your own method or class.

From there, you can create a new DataSeries called RSI (add RSI to Values enum), update it with the RSI values, then create a SMA from that new data series.

A theoretical code example after you've calculated your RSI value:

Java:
// add RSI to Values enum
public enum Values { RSI }

// calc rsi and get latest value
Double rsi = <get from your rsi calc code>

// place value into new RSI data series
series.setDouble(index, Values.RSI, rsi);

// create SMA from RSI data series
double SMAofRSI = series.sma(index, sma_period, Values.RSI);
 

Johnedoe

Well-known member
Joined
Feb 29, 2020
Posts
82
Likes
10
@Pejman I would like to know how to do it programmatically.

Your making this more complicated than you need to.
How will your methods results be any different than simply adding an SMA over the RSI as an overlay which is easy to do.
 
Top