Category Oscilators  Published on 16/02/2024

RSI with moving Average

Description

This is a simple but very useful indicator!! This is the same as the RSI indicator, but with very few changes and the addition of the moving average line

  • The placement of this index in the saturated ranges above 80 and below 20 can be a good sign for the price to return.
  • Breaking the moving average line by RSI in saturated ranges can also be an important signal for price reversal

Join our Telegram channel

Also, two Rsi Alert Multi Timeframe and Rsi Trendline Breakout Manager indicators can help you in successful trades with the RSI indicator.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Levels(20, 80)]
    [Indicator(AccessRights = AccessRights.None)]
    public class RSIMoving : Indicator
    {
        [Parameter("RSI Period", DefaultValue = 14, MinValue = 1)]
        public int RsiPeriod { get; set; }


        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple, Group = "MovingAverege")]
        public MovingAverageType maType { get; set; }
        [Parameter("MovingAverage Period", DefaultValue = 15, MinValue = 1, Group = "MovingAverege")]
        public int MovingAveragePeriod { get; set; }

        /*[Output("Bull Up", PlotType = PlotType.Histogram, LineColor = "ForestGreen", Thickness = 4)]
        public IndicatorDataSeries StrongBullish { get; set; }

        [Output("Bear Down", PlotType = PlotType.Histogram, LineColor = "Red", Thickness = 4)]
        public IndicatorDataSeries StrongBearish { get; set; }*/
        
        [Output("RSI", LineColor = "Red")]
        public IndicatorDataSeries Res_RSI { get; set; }
        [Output("Moving")]
        public IndicatorDataSeries Res_MOV { get; set; }

        public IndicatorDataSeries dataSeries_Ma;

        public IndicatorDataSeries dataSeries_Rsi;

        public MovingAverage _ma;

        public RelativeStrengthIndex _rsi;

        protected override void Initialize()
        {
            dataSeries_Ma = CreateDataSeries();

            dataSeries_Rsi = CreateDataSeries();
            _rsi = Indicators.RelativeStrengthIndex(dataSeries_Rsi, RsiPeriod);
            _ma = Indicators.MovingAverage(dataSeries_Ma, MovingAveragePeriod, maType);
        }

        public override void Calculate(int index)
        {
            dataSeries_Rsi[index] = (MarketSeries.Close[index] + MarketSeries.Open[index]) / 2;
            dataSeries_Ma[index] = _rsi.Result.Last(0);
            
            Res_RSI[index] =_rsi.Result[index];
            Res_MOV[index] = _ma.Result[index];

        }
    }
}

AlgoCreators's avatar
AlgoCreators

Joined on 16.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: RSIMoving.algo
  • Rating: 5
  • Installs: 565
Comments
Log in to add a comment.
AlgoCreators's avatar
AlgoCreators · 3 months ago

Hi slauek

I don't know, I haven't tested it with Mac

SL
slauek · 3 months ago

Hi

Will it work on Mac cTrader version?

Thanks