Files
QuanTAlib/lib/momentum/bop/Bop.Quantower.cs
T
86fe32a682 SIMD Refactor: Merge simd-dev into dev (#55)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
Co-authored-by: Warp <agent@warp.dev>
2026-01-18 19:02:03 -08:00

45 lines
1.3 KiB
C#

using System.Drawing;
using System.Runtime.CompilerServices;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
[SkipLocalsInit]
public sealed class BopIndicator : Indicator, IWatchlistIndicator
{
private Bop _bop = null!;
private readonly LineSeries _bopSeries;
public static int MinHistoryDepths => 0;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => "BOP";
public override string SourceCodeLink => "https://github.com/mihakralj/QuanTAlib/blob/main/lib/momentum/bop/Bop.Quantower.cs";
public BopIndicator()
{
OnBackGround = true;
SeparateWindow = true;
Name = "BOP - Balance of Power";
Description = "Measures the strength of buyers vs sellers";
_bopSeries = new LineSeries(name: "BOP", color: Color.Blue, width: 2, style: LineStyle.Solid);
AddLineSeries(_bopSeries);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override void OnInit()
{
_bop = new Bop();
base.OnInit();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override void OnUpdate(UpdateArgs args)
{
TValue result = _bop.Update(this.GetInputBar(args), args.IsNewBar());
_bopSeries.SetValue(result.Value);
}
}