PulseHub
PINE LIBRARY

SMCNexusTradePlanCoreV2

26
SMCNexusTradePlanCoreV2 is an open-source, non-visual Pine Script library for deterministic candidate-plan geometry.

The library receives already-detected market facts from an importing indicator and resolves candidate Entry, protective Stop Loss, real target clusters, risk-to-reward values, confluence and fail-closed plan validity.

It does not scan the chart independently, predict future prices, generate guaranteed signals, place orders or fabricate missing levels. The importing indicator remains responsible for detecting and confirming market structure, zones, liquidity, pivots and other market facts.

ORIGINAL CONCEPT AND PURPOSE

The library converts confirmed analytical facts into auditable candidate-plan geometry using fixed source priorities and strict validation rules.

Every Entry, Stop Loss and target must originate from a real level supplied by the importing indicator. Missing or contradictory information remains unavailable instead of being replaced with a synthetic price.

ENTRY RESOLUTION

The candidate direction is derived from the primary bias supplied by the importing indicator.

For a BUY candidate, the Entry zone is selected from the first available source in this fixed order:

1. Bullish Order Block
2. Bullish Fair Value Gap
3. Discount half of the current dealing range
4. S1 pivot

For a SELL candidate, the fixed order is:

1. Bearish Order Block
2. Bearish Fair Value Gap
3. Premium half of the current dealing range
4. R1 pivot

The candidate Entry is the midpoint of the selected zone. A single-price pivot remains a single-price zone.

The library does not search for the best historical result and does not reorder sources according to later price movement.

STOP LOSS RESOLUTION

Stop Loss candidates are checked using a fixed protective hierarchy.

For BUY candidates, a valid Stop Loss must be below Entry. For SELL candidates, it must be above Entry.

The available candidates are checked in this order:

1. Opposite-side liquidity level
2. Direction-matching Order Block edge
3. Dealing-range edge
4. Directional pivot

A candidate located on the wrong side of Entry is skipped without changing the priority of the remaining sources.

If no supplied level is directionally valid, Stop Loss remains unavailable. The library never creates a Stop Loss from a fixed percentage or an arbitrary distance.

REAL TARGET SELECTION

Targets must be genuine levels supplied by the importing indicator.

Possible sources may include:

• liquidity pools,
• opposing Order Blocks,
• opposing Fair Value Gaps,
• confirmed swing levels,
• pivots,
• Premium, Discount or Equilibrium levels.

The importing indicator owns one bounded TargetCandidate array and decides which confirmed levels are eligible.

Each candidate contains:

• real price,
• source identifier,
• origin type,
• stable origin key,
• confirmation bar,
• direction,
• active state.

Candidates located on the wrong side of Entry are rejected. The origin used for Entry or Stop Loss can also be excluded from the target collection.

TARGET CLUSTERING

Several analytical sources may describe practically the same price area. The library groups nearby candidates into separate clusters using a caller-provided distance.

The distance can be calculated from ATR using clusterDistance(). ATR controls cluster separation only. It never creates, moves or estimates a target price.

The nearest real representative from the first separate cluster becomes TP1. The nearest representative outside the TP1 cluster becomes TP2. The nearest representative outside the first two clusters becomes TP3.

Every selected target is therefore an actual price supplied by the importing indicator.

STABLE ORIGIN KEYS

The library provides helpers for creating auditable source identities:

• zoneKey(...)
• liquidityKey(...)
• swingKey(...)
• pdKey(...)
• pivotKey(...)

These keys help the importing indicator identify duplicate sources and prevent the same analytical object from being reused incorrectly.

FINAL VALIDATION

The final resolver calculates:

• risk distance,
• reward to TP1, TP2 and TP3,
• RR1, RR2 and RR3,
• candidate order type,
• latest structural confirmation,
• directional confluence,
• final sanity status.

The geometry must satisfy all required conditions:

• Entry and Stop Loss are available,
• Stop Loss is on the protective side of Entry,
• targets are on the correct side of Entry,
• targets are ordered nearest-to-farthest,
• required target data is complete.

Invalid geometry returns a specific fail-closed status instead of displaying an apparently valid plan.

PUBLIC API

Typed records:

• EntryResult
• TargetCandidate
• TargetSelection
• FinalResult

Exported functions:

• resolveEntry(...)
• sameLevel(...)
• zoneKey(...)
• liquidityKey(...)
• swingKey(...)
• pdKey(...)
• pivotKey(...)
• addCandidate(...)
• selectTargets(...)
• clusterDistance(...)
• riskDistance(...)
• resolveFinal(...)

INTENDED USE

The importing indicator should:

1. Detect and confirm its own structure, zones, liquidity and pivots.
2. Pass the current facts to resolveEntry().
3. Add only genuine eligible levels to one bounded candidate array.
4. Call selectTargets() using an explicit cluster distance.
5. Pass Entry, Stop Loss, targets and contextual facts to resolveFinal().
6. Display a candidate only when the returned validity state permits it.

Conceptual example:

```pine
import AreXoN_/SMCNexusTradePlanCoreV2/1 as plan

plan.EntryResult entry = plan.resolveEntry(
primaryBias,
bullishObActive, bullishObHigh, bullishObLow,
bearishObActive, bearishObHigh, bearishObLow,
bullishFvgActive, bullishFvgHigh, bullishFvgLow,
bearishFvgActive, bearishFvgHigh, bearishFvgLow,
dealingRangeValid, dealingRangeHigh, dealingRangeLow,
equilibrium,
pivotS1Available, pivotS1,
pivotR1Available, pivotR1,
lastSsl, lastBsl)

array<plan.TargetCandidate> candidates =
array.new<plan.TargetCandidate>()

// Add only confirmed real levels detected by the importing indicator.

float distance = plan.clusterDistance(atrValue, 0.55)

plan.TargetSelection targets =
plan.selectTargets(
candidates,
entry.isBuy ? 1 : -1,
distance)
```

The example import path should be replaced with the exact path assigned by PulseWire after publication.

WHY THE CHART IS CLEAN

This is a non-visual calculation library. It intentionally creates no plots, labels, tables, lines or boxes.

The publication chart is therefore intentionally clean and contains no additional indicators, drawings or unexplained visual elements. Visual presentation is the responsibility of an importing indicator.

LIMITATIONS

• The result depends entirely on the confirmed facts supplied by the importing indicator.
• It is a mechanical analytical candidate, not a recommendation.
• It cannot verify live spread, slippage, broker StopLevel or execution rules.
• It does not provide native bid/ask order flow.
• It does not place, modify or close orders.
• Missing real levels produce an incomplete result by design.
• Risk-to-reward values describe supplied geometry and do not predict outcome.
• It produces no chart output by itself.

This library is an analytical and software-development component. It is not investment advice, a trading recommendation or an automated trading system.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.