feat (Volume): add configurable horizontal threshold lines#166
Open
AlbertoAmadorBelchistim wants to merge 1 commit into
Open
feat (Volume): add configurable horizontal threshold lines#166AlbertoAmadorBelchistim wants to merge 1 commit into
AlbertoAmadorBelchistim wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
MaximumVolumeoverlay convention (which plots a dynamic line on the same panel), but with user-defined static levels instead of a rolling maximum.Changes
ShowThresholdLinestoggle on the Visualization tab - gates rendering of both lines.FixedMinorLevel(default1000) andFixedMajorLevel(default2000)decimalproperties under a Fixed threshold group.ValueDataSeries(_thrMinor,_thrMajor) added toDataSerieswithIsHidden = false, so color / width / dash style are user-customizable from the standard DataSeries panel. Defaults: dim gray dotted (minor) and dark gray solid (major).OnCalculateonly when the toggle is on. Turning the toggle off callsSetPointOfEndLine(CurrentBar - 1)on both series and triggers aRecalculateValues(), so the lines cut cleanly and stop accumulating.Localization - note for reviewers
I don't have access to
Strings.resxfrom outside the build pipeline, so the new UI strings are hardcoded inside the file, isolated in a dedicated#region UI stringsblock 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:
ThresholdsFixedThresholdMinorLevelMinorLevelDescriptionMajorLevelMajorLevelDescriptionShowThresholdLinesDescriptionThe toggle label itself reuses the existing
Strings.Showkey, matching the pattern used byShowMaxVolumeandShowVolume. 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
FixedMinorLevel/FixedMajorLeveltriggers a redraw at the new level.Input(Volume / Ticks / Ask / Bid) keeps the thresholds at the user-defined absolute values.