Skip to main content

BarMetricsSignal

Evaluates one or more bar metrics (body size, wick proportions, candlestick patterns) against thresholds. All conditions must be met (AND logic) for the signal to fire. The direction is fixed at construction.

Namespace: MZpack.NT8.Algo.Signals Inheritance: BarMetricsSignal : Signal Data source: Level1 | Calculate: OnBarClose Source: [INSTALL PATH]/API/Signals/BarMetricsSignal.cs

Constructors

Single metric:

new BarMetricsSignal(strategy, ago, barMetrics, minMax, value, allowed)

Multiple metrics:

new BarMetricsSignal(strategy, ago, barMetricsDescArray, allowed)
ParameterTypeDescription
agointBars ago to evaluate (0 = current bar)
barMetricsBarMetricsMetric to check
minMaxMinMaxWhether value is a minimum or maximum threshold
valueintThreshold value in ticks
barMetricsDescBarMetricsDesc[]Array of metric descriptors for multi-condition checks
allowedSignalDirectionDirection returned when all conditions pass

Signal Logic

Each metric in the array is checked in sequence. If any condition fails, the signal returns no direction. Only when all conditions pass does it return the allowed direction. The signal does not produce an entry price.

BarMetrics Enum

ValueDescription
BodyBar body size in ticks
SizeFull bar range in ticks (High − Low)
UpperWickUpper wick size in ticks
LowerWickLower wick size in ticks
BodyPercentBody as percentage of full range
UpperWickPercentUpper wick as percentage of full range
LowerWickPercentLower wick as percentage of full range
HammerHammer candlestick pattern (boolean check, no threshold)
DojiDoji candlestick pattern (boolean check, no threshold)

MinMax Enum

ValueDescription
MinValue must be >= threshold
MaxValue must be <= threshold

Example

// Single metric: body >= 4 ticks, 0 bars ago, Long direction
var signal = new BarMetricsSignal(strategy, 0,
BarMetrics.Body, MinMax.Min, 4, SignalDirection.Long);

pattern.Signals.Root.Add(signal);

// Multiple metrics: body >= 4 ticks AND upper wick <= 2 ticks
var desc = new BarMetricsDesc[]
{
new BarMetricsDesc { BarMetrics = BarMetrics.Body, MinMax = MinMax.Min, Value = 4 },
new BarMetricsDesc { BarMetrics = BarMetrics.UpperWick, MinMax = MinMax.Max, Value = 2 }
};
var signal2 = new BarMetricsSignal(strategy, 0, desc, SignalDirection.Short);

pattern.Signals.Root.Add(signal2);