IN

indicator-buffer

Assists in implementing BufferList incremental indicators for chain or quote processing.

Install

mkdir -p .claude/skills/indicator-buffer && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4121" && unzip -o skill.zip -d .claude/skills/indicator-buffer && rm skill.zip

Installs to .claude/skills/indicator-buffer

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Implement BufferList incremental indicators with efficient state management. Use for IIncrementFromChain or IIncrementFromBar implementations. Covers interface selection, constructor patterns, and BufferListTestBase testing requirements.
237 chars✓ has a “when” trigger
Advanced

Key capabilities

  • →Implement incremental indicators
  • →Manage state for IIncrementFromChain or IIncrementFromBar
  • →Verify series parity in tests
  • →Register indicators in the catalog

How it works

The skill provides a framework for developing incremental indicators by inheriting from BufferList, implementing specific interfaces, and using rolling buffers for efficient state management.

Inputs & outputs

You give it
Indicator parameters and input data
You get back
Incremental indicator implementation

When to use indicator-buffer

  • →Implement financial indicators
  • →Use BufferList for state management
  • →Write tests for indicator implementations

About this skill

BufferList indicator development

A BufferList must produce results identical to the Series output for the same input. The indicator-series skill owns the full per-indicator file set and completion checklist; this skill covers only the {Name}List.cs file and its tests.

Increment interface

Pick the interface from the Series input type. Both are internal and live in src/Common/BufferLists/.

Series inputInterfaceAdd overloads to implement
IReadOnlyList<IReusable>IIncrementFromChainAdd(DateTime timestamp, double value), Add(IReusable value), Add(IReadOnlyList<IReusable> values)
IReadOnlyList<IBar>IIncrementFromBarAdd(IBar bar), Add(IReadOnlyList<IBar> bars)
  • Route every chain overload through Add(DateTime, double) so the calculation exists once.
  • Pass value.Value from the IReusable overloads, or value.Hl2OrValue() where the Series defaults bars to HL2 (Alligator and Awesome, for example).
  • An IIncrementFromBar list has no IReusable overloads. It accepts bars and any result that is an IBar (such as HeikinAshiResult, a Bar record), but never an arbitrary IReusable result.

Class shape

src/Indicators/e-j/Ema/EmaList.cs (chain) and src/Indicators/a-b/Adx/AdxList.cs (bar) are the reference implementations.

public class EmaList : BufferList<EmaResult>, IIncrementFromChain, IEma
{
    private readonly Queue<double> _buffer;

    public EmaList(int lookbackPeriods)
    {
        Ema.Validate(lookbackPeriods);
        LookbackPeriods = lookbackPeriods;
        _buffer = new Queue<double>(lookbackPeriods);
        Name = $"EMA({lookbackPeriods})";
    }

    public EmaList(int lookbackPeriods, IReadOnlyList<IReusable> values)
        : this(lookbackPeriods) => Add(values);
}

public static partial class Ema
{
    public static EmaList ToEmaList(
        this IReadOnlyList<IReusable> source,
        int lookbackPeriods)
        => new(lookbackPeriods) { source };
}
  • The primary constructor validates with the Series Validate(...), stores parameters as I{Name} properties, allocates buffers, and sets Name.
  • The chaining constructor takes IReadOnlyList<IReusable> or IReadOnlyList<IBar> to match the interface and delegates with : this(...) => Add(...).
  • The To{Name}List() extension sits in the same file and uses a collection initializer.
  • Append results with AddInternal(...), which also enforces MaxListSize; revise an earlier result with UpdateInternal(index, ...).

Buffers and state

  • Roll a fixed window with _buffer.Update(capacity, value) from BufferListUtilities.
  • Use _buffer.UpdateWithDequeue(capacity, value) to maintain a running sum. For a value-type T it returns default(T) (0), not null, when nothing was dequeued, so gate the subtraction on whether the buffer was full before the call.
  • Override Clear() to call base.Clear() and reset every buffer, running sum, and cached prior value.
  • When the list keeps history outside a capacity-bounded Queue<T> (a List<T> cache, for example), override PruneList() so that history shrinks with the list.

Tests

{Name}BufferListTests inherits BufferListTestBase and implements ITestChainBufferList for IIncrementFromChain or ITestBarBufferList for IIncrementFromBar, plus ITestCustomBufferListCache for a custom cache. Every test that produces results asserts IsExactly against the Series output. The testing-standards skill lists the required methods.

Do not do these

  • Do not add Add(IBar) overloads to an IIncrementFromChain list or Add(IReusable) overloads to an IIncrementFromBar list.
  • Do not reimplement the Series formula differently; reuse its Increment(...) kernel where one exists.
  • Do not grow an internal collection without bound; every buffer is capacity-limited or pruned with the list.

When not to use it

  • →When implementing non-incremental indicators
  • →When the indicator does not require state management

Prerequisites

BufferList base classBufferListTestBase for testing

Limitations

  • →Requires adherence to specific constructor patterns
  • →Testing requires implementation of specific test interfaces

How it compares

It enforces a standardized development and testing pattern for incremental indicators, ensuring consistency and performance compared to ad-hoc implementations.

Compared to similar skills

indicator-buffer side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
indicator-buffer (this skill)14moNo flagsAdvanced
zod-41210moNo flagsIntermediate
develop-ai-functions-example59moReviewIntermediate
agent-implementer-sparc-coder19moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry