Skip to content

feat (Volume): add configurable horizontal threshold lines#166

Open
AlbertoAmadorBelchistim wants to merge 1 commit into
AtasPlatform:Developfrom
AlbertoAmadorBelchistim:feat/volume-threshold-fixed
Open

feat (Volume): add configurable horizontal threshold lines#166
AlbertoAmadorBelchistim wants to merge 1 commit into
AtasPlatform:Developfrom
AlbertoAmadorBelchistim:feat/volume-threshold-fixed

Conversation

@AlbertoAmadorBelchistim
Copy link
Copy Markdown
Contributor

Summary

Adds two configurable horizontal reference lines (a minor and a major level) to the Volume indicator panel, gated by a new "Show threshold lines" toggle. Useful for volume-based confirmation rules where the trader compares each bar against fixed thresholds.

This mirrors the existing MaximumVolume overlay convention (which plots a dynamic line on the same panel), but with user-defined static levels instead of a rolling maximum.

image

Changes

  • New ShowThresholdLines toggle on the Visualization tab - gates rendering of both lines.
  • New FixedMinorLevel (default 1000) and FixedMajorLevel (default 2000) decimal properties under a Fixed threshold group.
  • Two new ValueDataSeries (_thrMinor, _thrMajor) added to DataSeries with IsHidden = false, so color / width / dash style are user-customizable from the standard DataSeries panel. Defaults: dim gray dotted (minor) and dark gray solid (major).
  • Threshold values are written from OnCalculate only when the toggle is on. Turning the toggle off calls SetPointOfEndLine(CurrentBar - 1) on both series and triggers a RecalculateValues(), so the lines cut cleanly and stop accumulating.
  • No changes to histogram calculation, alerts, color logic, or any existing public surface.

Localization - note for reviewers

I don't have access to Strings.resx from outside the build pipeline, so the new UI strings are hardcoded inside the file, isolated in a dedicated #region UI strings block at the top of the class. Each constant is named so it maps 1:1 to a target resource key, and the region carries an in-code note to that effect.

Here are the 7 entries:

Suggested key English value
Thresholds Thresholds
FixedThreshold Fixed threshold
MinorLevel Minor level
MinorLevelDescription Value of the minor threshold line.
MajorLevel Major level
MajorLevelDescription Value of the major threshold line.
ShowThresholdLinesDescription Show horizontal threshold lines on the Volume panel.

The toggle label itself reuses the existing Strings.Show key, matching the pattern used by ShowMaxVolume and ShowVolume. Series IDs are internal, not displayed, and don't need resource entries.

Compatibility

The file already uses [Tab] attributes on its existing properties (Input, UseFilter, FilterColor, ShowMaxVolume, etc.), so the indicator was already restricted to flavors that support the tab system. This PR adds three more [Tab]-decorated properties under that same constraint - no new compatibility restrictions are introduced.

No public API changes. Existing user templates load unchanged: the toggle defaults to off and the legacy series initialization (_positive, _negative, _neutral) is untouched.

Test notes

  • Toggle on / off cycles cleanly: lines appear, follow level changes, disappear and stop writing when off.
  • Changing FixedMinorLevel / FixedMajorLevel triggers a redraw at the new level.
  • Color, width, and dash style can be customized from the DataSeries panel; the defaults match the dim/dark gray convention of similar reference lines.
  • Switching Input (Volume / Ticks / Ask / Bid) keeps the thresholds at the user-defined absolute values.

Adds two configurable horizontal reference lines (minor / major) drawn on the
Volume panel to help classify bars as normal, high or exceptional volume.
The feature is fully opt-in: disabled by default, no change to existing
behavior or templates.

Implementation notes:
- Renders via two `ValueDataSeries` with `VisualMode.Line`, so the lines
  integrate natively with templates, exports, chart styling and the standard
  "double-click on legend" editor (color, width and dash are user-editable
  and persisted in templates).
- `SetPointOfEndLine` is used when the feature is toggled off to prevent
  connecting segments across disabled regions.
- Threshold series are marked `IgnoredByAlerts = true` and
  `ShowCurrentValue = false` to avoid cluttering alerts and the legend.
- Setters only call `RecalculateValues()`, consistent with the rest of the
  indicator (no extra `RedrawChart()` churn).

New user-facing properties (group "Thresholds" / "Fixed threshold"):
- ShowThresholdLines (bool, default false)
- FixedMinorLevel (decimal, default 1000)
- FixedMajorLevel (decimal, default 2000)

UI strings are centralized in a dedicated `#region UI strings` block with
a migration note, so they can be moved to `Strings.resx` during review
with a mechanical 1:1 replacement.

No new dependencies. Backward compatible with existing templates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant