Category Oscilators  Published on 18/02/2023

Internal Bar Strength indicator

Description

This indicator developed by Volker Knapp. It is calculated as the moving average of the values of the internal bars strength that represent the ratio (close-low)/(high-low) * 100% for each of them

The crossing of 60% level means the overbuying and the crossing of 40% level means overselling, and so they are the signals for selling and buying respectively.


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

namespace cAlgo
{
    [Levels(40,50,60)]
    [Indicator(AccessRights = AccessRights.None)]
    public class mInternalBarStrength : Indicator
    {
        [Parameter("Periods (5)", DefaultValue = 5)]
        public int inpPeriods { get; set; }
        [Parameter("SmoothType (sma)", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType inpSmoothType { get; set; }

        [Output("Internal Bar Strength", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outIBS { get; set; }
        
        private IndicatorDataSeries _deltahl, _rawibs;
        private MovingAverage _smoothibs;
        

        protected override void Initialize()
        {
            _deltahl = CreateDataSeries();
            _rawibs = CreateDataSeries();
            _smoothibs = Indicators.MovingAverage(_rawibs, inpPeriods, inpSmoothType);
        }

        public override void Calculate(int i)
        {
            _deltahl[i] = Bars.HighPrices[i] - Bars.LowPrices[i];
            _rawibs[i] = _deltahl[i] > 0 ? (Bars.ClosePrices[i] - Bars.LowPrices[i]) / _deltahl[i] : 0;
            
            outIBS[i] = 100.0 * _smoothibs.Result[i];
        }
    }
}

mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mInternalBarStrength.algo
  • Rating: 5
  • Installs: 482
Comments
Log in to add a comment.
No comments found.