Relative Momentum Index indicator free

by mfejza in category Oscilator at 08/09/2022
Description

Relative Momentum Index indicator script. This indicator was originally developed by Roger Altman (Stocks & Commodities V. 11:2 (57-60)).

Use this indicator as trade zones; for long when indicator value is above level 70; for short when indicator value is below level 30

 

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Levels(30, 50, 70)]
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    public class mRelativeMomentumIndex : Indicator
    {
        [Parameter("RMI Periods (14)", DefaultValue = 7)]
        public int inpPeriodsRMI { get; set; }
        [Parameter("Momentum Periods (10)", DefaultValue = 5)]
        public int inpPeriodMomentum { get; set; }

        [Output("Relative Momentum Index", LineColor = "Black", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outRMI { get; set; }

        private IndicatorDataSeries _bulls, _bears, _rmi;
        private double delta;


        protected override void Initialize()
        {
            _bulls = CreateDataSeries();
            _bears = CreateDataSeries();
            _rmi = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            delta = i > inpPeriodMomentum ? Bars.ClosePrices[i] - Bars.ClosePrices[i - inpPeriodMomentum] : Bars.ClosePrices[i] - Bars.TypicalPrices[i];

            _bulls[i] = ((i > 1 ? _bulls[i - 1] : 50.0) * (inpPeriodsRMI - 1) + (delta > 0.0 ? +delta : 0.0)) / inpPeriodsRMI;
            _bears[i] = ((i > 1 ? _bears[i - 1] : 50.0) * (inpPeriodsRMI - 1) + (delta < 0.0 ? -delta : 0.0)) / inpPeriodsRMI;

            if (_bears[i] != 0.0)
                _rmi[i] = 100.0 - 100.0 / (1 + _bulls[i] / _bears[i]);
            else
                _rmi[i] = 50.0;

            outRMI[i] = _rmi[i];
        }
    }
}
Comments

gmkenneyy - December 20, 2022 @ 23:41

"Use this indicator as trade zones; for long when indicator value is above level 70; for short when indicator value is below level 30"

I dont not belive this to be correct according to the screen shot YOU provided - i think you meant <30 go long, > 70 go short

0