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
Joined on 23.09.2013
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Balance of Power.algo
- Rating: 0
- Installs: 1507
- Modified: 13/10/2021 09:55
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.