Skip to main content

Signal Base Classes

All signals inherit from Node, which provides tree structure, direction handling, and event routing. Signal adds market data processing, chart range tracking, and indicator access. LogicalNode provides AND/OR/CONJUNCTION logic between signals.

Namespace: MZpack.NT8.Algo

Node

Node is the abstract base class for all elements in the decision tree.

Inheritance: Node : ViewModelBase, ICloneable Source: [INSTALL PATH]/API/Signals/Node.cs

Key Properties

PropertyTypeDescription
NamestringSignal name
IsEnabledboolEnable/disable on-the-fly
DirectionSignalDirectionValidated direction (None, Long, Short, Any)
EntryPricedoubleEntry price from signal validation
StopLossPricedoubleStop loss price (if signal provides one)
ProfitTargetPricedoubleProfit target price (if signal provides one)
TreeSignalsTreeParent decision tree
ParentNodeParent node in tree
NodesObservableCollection<Node>Child nodes

Key Methods

MethodDescription
OnMarketEvent(object e, MarketDataSource source, bool isFirstTickOfBar, SignalDirection allowed)Process market event (abstract)
OnCalculate(MarketDataEventArgs e, int barIdx, SignalDirection allowed)Calculate on Level 1 data (abstract)
OnCalculate(MarketDepthEventArgs e, int barIdx, SignalDirection allowed)Calculate on Level 2 data (abstract)
GetRange(ChartRange range)Get validated chart range (abstract)
CheckSyntax()Validate node structure (abstract)

Static Direction Helpers

MethodDescription
Invert(SignalDirection)Long ↔ Short
IsDetermined(SignalDirection)Returns true for Long or Short
ResolveDirection(SignalDirection resolve, SignalDirection allowed)Apply allowed constraint
IsOppositeDirections(SignalDirection a, SignalDirection b)Check if Long vs Short

Signal

Signal extends Node with market data processing, indicator access, and chart range tracking.

Inheritance: Signal : Node Source: [INSTALL PATH]/API/Signal.cs

Key Properties

PropertyTypeDescription
StrategyStrategyParent Algo.Strategy
MarketDataSourceMarketDataSourceData source: Level1, Level2, or Custom
DataSeriesIndexintData series index (default: 0)
CalculateSignalCalculateWhen to calculate: OnEachTick, OnBarClose, NotApplicable
IsResetboolRe-evaluate on every event (vs. hold state after validation)
HasPriceboolWhether signal provides an entry price
ChartRangeChartRangeBar/price range where signal validated
TimeDateTimeWhen signal was validated
DescriptionstringTextual description of validated state
PartiallyVisibleModeSignalPartiallyVisibleModeVisibility in Partially Visible mode

Constructor

public Signal(Strategy strategy, MarketDataSource source,
SignalCalculate calculate, bool isReset)

Key Methods

MethodDescription
GetEffectiveCurrentBarIndex()Current bar index adjusted for Calculate mode
GetCurrentBarAgo()Returns 1 for OnBarClose, 0 for OnEachTick
GetBestEntryPrice(SignalDirection)Best bid for Long, best ask for Short
IsMarketEventSupported(MarketDataSource)Check if event matches this signal
ReferIndicators()Grab indicators from strategy based on templates

LogicalNode

LogicalNode provides AND/OR/CONJUNCTION logic between child nodes.

Inheritance: LogicalNode : Node Source: [INSTALL PATH]/API/Signals/LogicalNode.cs

Properties

PropertyTypeDescription
LogicLogicAnd, Or, or Conjunction

Logic Behavior

LogicBehavior
AndAll children must resolve to a determined direction
OrFirst child with determined direction wins
ConjunctionUpgrades directions: Long + Short = Any

Example

// Root AND node with two signals
var root = pattern.Signals.Root; // LogicalNode with Logic.And
root.Add(new FootprintImbalanceSignal(...));
root.Add(new BarDeltaSignal(...));

// Add an OR sub-group
var orNode = new LogicalNode(Logic.Or);
orNode.AddChild(new BigTradeSignal(...));
orNode.AddChild(new DOMImbalanceSignal(...));
root.Add(orNode);

RangeNode / Range

RangeNode implements IRange to constrain how far apart signals can validate and still count as one pattern.

Inheritance: RangeNode : Node, IRange | Range : RangeNode Source: [INSTALL PATH]/API/Signals/RangeNode.cs, [INSTALL PATH]/API/Range.cs

Properties

PropertyTypeDefaultDescription
Barsint0Max bar distance (0 = no limit)
Ticksint0Max tick distance (0 = no limit)
LogicLogicAndHow Bars and Ticks combine
IsInSessionboolfalseRestrict to current session

Enums

SignalDirection

ValueDescription
NoneSignal not triggered
LongBuy signal
ShortSell signal
AnyBoth directions (used by filters and Conjunction logic)

SignalCalculate

ValueDescription
OnEachTickEvaluate on every tick
OnBarCloseEvaluate once per bar close
NotApplicableFor Level 2 and custom data sources

MarketDataSource

ValueDescription
NoneNo source
Level1Order flow / tick data
Level2DOM / market depth data
CustomCustom events

Logic

ValueDescription
AndAll conditions must be true
OrAny condition is sufficient
ConjunctionDirection upgrade (Long + Short = Any)

See Also