Category Oscilators  Published on 07/09/2021

Balance Of Power (BOP)

Description

This is the Balance of Power (BOP) oscillator indicator for cTrader.

Github: spotware/Balance-of-Power: This Balance of Power (BOP) indicator for cTrader (github.com)


// -------------------------------------------------------------------------------------------------
//
//    This is the Balance Of Power custom indicator for cTrader based on Automate API.
//
// -------------------------------------------------------------------------------------------------

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BalanceofPower : Indicator
    {
        private IndicatorDataSeries _bop;
        private MovingAverage _ma;

        [Parameter("Periods", DefaultValue = 14)]
        public int Periods { get; set; }

        [Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType MaType { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {
            _bop = CreateDataSeries();
            _ma = Indicators.MovingAverage(_bop, Periods, MaType);
        }

        public override void Calculate(int index)
        {
            var bar = Bars[index];

            _bop[index] = (bar.Close - bar.Open) / (bar.High - bar.Low);
            Result[index] = _ma.Result[index];
        }
    }
}

Spotware's avatar
Spotware

Joined on 23.09.2013

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Balance of Power.algo
  • Rating: 0
  • Installs: 1300
Comments
Log in to add a comment.
No comments found.