Category Oscilators  Published on 25/01/2023

Iba Smooth indicator

Description

The 'IbaSmooth' indicator is a custom indicator designed to be used as a short and long-term reference for price movement. The result is interpreted through two components of the indicator, one for the short term and one for the long term, based on defined lookback periods.

According to the author's information, this indicator identifies the price sentiment for a long trade when both indicator components are above the zero level and for a short trade when both components are below the zero level.

In Memoriam Iba.

 


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

namespace cAlgo
{
    [Levels(+50,0,-50)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mIbaSmooth : Indicator
    {
        [Parameter("Fast Period (5)", DefaultValue = 5)]
        public int inpPeriodFast { get; set; }
        [Parameter("Slow Period (20)", DefaultValue = 20)]
        public int inpPeriodSlow { get; set; }
        [Parameter("Oscillate Period (15)", DefaultValue = 15)]
        public int inpPeriodOscillate { get; set; }

        [Output("Fast Component", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outFastComponent { get; set; }
        [Output("Slow Component", LineColor = "Red", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outSlowComponent { get; set; }
        
        private MovingAverage _smoothfast, _smoothslow;
        private IndicatorDataSeries _rawfast, _rawslow, _oscfast, _oscslow;
        private RelativeStrengthIndex _rsifast, _rsislow;
        

        protected override void Initialize()
        {
            _smoothfast = Indicators.MovingAverage(Bars.ClosePrices, inpPeriodFast, MovingAverageType.Exponential);
            _smoothslow = Indicators.MovingAverage(Bars.ClosePrices, inpPeriodSlow, MovingAverageType.Exponential);
            _rawfast = CreateDataSeries();
            _rawslow = CreateDataSeries();
            _rsifast = Indicators.RelativeStrengthIndex(_rawfast, inpPeriodOscillate);
            _rsislow = Indicators.RelativeStrengthIndex(_rawslow, inpPeriodSlow);
            _oscfast = CreateDataSeries();
            _oscslow = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _rawfast[i] = _smoothfast.Result[i] - _smoothslow.Result[i];
            _rawslow[i] = _smoothslow.Result[i];
            _oscfast[i] = i>inpPeriodOscillate ? _rsifast.Result[i] - 50.0 : 0;
            _oscslow[i] = i>inpPeriodOscillate ? _rsislow.Result[i] - 50.0 : 0;

            outFastComponent[i] = _oscfast[i];
            outSlowComponent[i] = _oscslow[i];
        }
    }
}

mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mIbaSmooth.algo
  • Rating: 0
  • Installs: 229
  • Modified: 21/11/2023 13:32
Comments
Log in to add a comment.
No comments found.