RSI on Chart free

by mfejza in category Other at 01/09/2022
Description

Show RSI indicator on chart (in Pips)

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.Indicators
{
    [Levels(30, 70)]
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class mRSIonChart : Indicator
    {
        [Parameter("Smooth Type (ema)", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType inpSmoothType { get; set; }
        [Parameter("Periods (14)", DefaultValue = 14, MinValue = 1)]
        public int inpPeriods { get; set; }
        [Parameter("OverBought level (70)", DefaultValue = 70.0)]
        public double inpOverBought { get; set; }
        [Parameter("OverSold level (30)", DefaultValue = 30.0)]
        public double inpOverSold { get; set; }

        [Output("RSI", LineColor = "Black")]
        public IndicatorDataSeries outRSIch { get; set; }
        [Output("RSI LevelUp", LineColor = "Green")]
        public IndicatorDataSeries outRSIchUp { get; set; }
        [Output("RSI LevelDn", LineColor = "Green")]
        public IndicatorDataSeries outRSIchDn { get; set; }

        private IndicatorDataSeries _aucd, _adcd, _X1, _X2, _UB, _LB;
        private MovingAverage _auc, _adc;
        private int _ep;

        protected override void Initialize()
        {
            _ep = 2 * inpPeriods - 1;
            _aucd = CreateDataSeries();
            _adcd = CreateDataSeries();
            _X1 = CreateDataSeries();
            _UB = CreateDataSeries();
            _X2 = CreateDataSeries();
            _LB = CreateDataSeries();
            _auc = Indicators.MovingAverage(_aucd, _ep, inpSmoothType);
            _adc = Indicators.MovingAverage(_adcd, _ep, inpSmoothType);
        }

        public override void Calculate(int i)
        {
            _aucd[i] = Math.Max(Bars.ClosePrices[i] - Bars.ClosePrices[i - 1], 0);
            _adcd[i] = Math.Max(Bars.ClosePrices[i - 1] - Bars.ClosePrices[i], 0);

            _X1[i] = (inpPeriods - 1) * (_adc.Result[i] * inpOverBought / (100 - inpOverBought) - _auc.Result[i]);
            _X2[i] = (inpPeriods - 1) * (_adc.Result[i] * inpOverSold / (100 - inpOverSold) - _auc.Result[i]);

            if (_X1[i] >= 0)
                _UB[i] = Bars.ClosePrices[i] + _X1[i];
            else
                _UB[i] = Bars.ClosePrices[i] + _X1[i] * (100 - inpOverBought) / inpOverBought;

            if (_X2[i] >= 0)
                _LB[i] = Bars.ClosePrices[i] + _X2[i];
            else
                _LB[i] = Bars.ClosePrices[i] + _X2[i] * (100 - inpOverSold) / inpOverSold;


            outRSIch[i] = (_UB[i] + _LB[i]) / 2;
            outRSIchUp[i] = _UB[i];
            outRSIchDn[i] = _LB[i];
        }
    }
}
Comments

sosayoung6464034 - September 08, 2022 @ 10:11

i really don't understand this problem can you be more specific, do you know anything about moto x3m

junealexis001 - September 12, 2022 @ 11:52

Interesting post i love it keep posting more!  https://paintersamarillotexas.com

0