Put Moving Average on RSI Indicator in code
Put Moving Average on RSI Indicator in code
24 Aug 2015, 16:48
Hi, it is possible to set the source of a simple moving average on a chart to the source of an rsi indicator. This then shows the moving average in the RSI window. However, the problem i'm having is being able to do this in code.
The SimpleMovingAverage requires a DataSeries source and I can't seem to be able to get the dataseries of the RSI.
Replies
Spotware
26 Aug 2015, 13:47
Dear Trader,
We do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You also can contact one of our Partners or post a job in Development Jobs section for further coding assistance.
@Spotware
paul.williams125
26 Jan 2020, 12:24
RE:
rsi = Indicators.RelativeStrengthIndex(MarketData.Close, Period, MAType); sma = Indicators.SimpleMovingAverage(rsi, Period);
or
public IndicatorDataSeries dataSeries;
--------------------------------------------------------------------------
dataSeries = CreateDataSeries();
rsi = Indicators.RelativeStrengthIndex(MarketData.Close, Period, MAType);
sma = Indicators.SimpleMovingAverage(dataSeries, Period);
-----------------------------------------------------------------------
dataSeries[index] = rsi.Result[index];
-------------------------------------------------------------------------
-------------------------------------------------------------------------
This is 5% better.
public IndicatorDataSeries dataSeries_Ma;
public IndicatorDataSeries dataSeries_Rsi;
public MovingAverage _ma;
public RelativeStrengthIndex _rsi;
-----------------------------------------------------------------------
dataSeries_Ma = CreateDataSeries();
dataSeries_Rsi = CreateDataSeries();
_rsi = Indicators.RelativeStrengthIndex(dataSeries_Rsi, Period, MAType);
_ma = Indicators.MovingAverage(dataSeries_Ma, Period, MAType);
-----------------------------------------------------------------------
dataSeries_Rsi[index] = (MarketSeries.Close + MarketSeries.Open) / 2
dataSeries_Ma[index] = rsi.Result[index];
(close + open /2 ) is better because close, swings about a lot, high and low is noise
I want to write an algo that smooths the price, using price action patterns , lots of moves stored - just like a computer that plays chess. nearly there...
@paul.williams125
Spotware
25 Aug 2015, 09:06
RE:
usynn said:
Dear Trader,
Could you please explain your issue in more detail?
In the following code snippet the SMA and the RSI indicator will be initialized with the same DataSeries.
@Spotware