Threshold lines

Indicators

Threshold lines

Static reference levels — RSI 30/70, Stochastic 20/80, ADX 20/40 — drawn as constant-height strokes across your indicator's panel.

What a threshold line is

A threshold line is a horizontal reference level at a fixed Y-value, with no time component — TradeStrike's equivalent of NinjaTrader's AddLine(). It is not data: it doesn't change from bar to bar, so it isn't a plot. It has its own mechanism so the chart draws it, the legend lists it, and the user's tweaks (colour, style) round-trip in saved templates. The chart reads IIndicator.Lines alongside Plots and strokes a constant-Y line across the panel.

Adding lines

Declare lines from the constructor (or OnInit) with the protected AddLine helper. The convenience overload takes (name, value, color, lineWidthPx = 1.0, style = PlotStyle.Line, participatesInAutoScale = true).

adding threshold linespublic Rsi(IIndicator? parent = null, ISeries<double>? input = null) : base(parent, input)
{
    AddPlot(new Plot("RSI", _rsi, PlotStyle.Line, new ChartColor(156, 39, 176), 1.5));

    // Overbought / oversold reference bands. Dashed reads as "guide, not data".
    AddLine("Overbought", 70, new ChartColor(120, 120, 120), 1.0, PlotStyle.Dashed);
    AddLine("Oversold",   30, new ChartColor(120, 120, 120), 1.0, PlotStyle.Dashed);
}

Like plots, lines are mutable at runtime — Name, Value, Color, LineWidthPx, Style and Visible are all settable so the settings dialog can restyle them.

Bounded vs unbounded indicators

The last argument, participatesInAutoScale, controls whether the line's value is folded into the subpanel's Y-axis auto-scale:

  • true (default) — right for bounded oscillators (RSI 30/70, Stochastic 20/80) whose data naturally lives near the bands, so the bands always stay on-screen.
  • false — right for unbounded indicators (ADX/ADXR), where forcing a 75 reference line into the scale would squash a typical 10–30 reading into a sliver. The line is still drawn (and clipped if off-range) but never stretches the scale.
an unbounded reference line// ADX rarely exceeds 60; keep the 75 reference off the auto-scale.
AddLine("Strong trend", 75, new ChartColor(120, 120, 120),
        lineWidthPx: 1.0, style: PlotStyle.Dashed, participatesInAutoScale: false);

When can I call AddLine?

Only in the constructor or OnInit. The Lines list, like Plots, is fixed for the indicator's lifetime — the chart caches it and the settings dialog binds to it. If a level needs to change as the market moves, it is a plot (a computed per-bar series), not a threshold line.
Rule of thumb. A line is a fixed reference the user reasons against; a plot is a value your indicator computes each bar. A moving level (a trailing band, a dynamic stop) is always a plot.