PATEBLOAv1Library "PATEBLOAv1"
f_barScale(scaleWin)
โโParameters:
โโโโ scaleWin (int)
f_scope(tid, tf)
โโParameters:
โโโโ tid (string)
โโโโ tf (string)
f_pivotHigh(L, R)
โโParameters:
โโโโ L (int)
โโโโ R (int)
f_pivotLow(L, R)
โโParameters:
โโโโ L (int)
โโโโ R (int)
f_winMaxHigh(L, R)
โโParameters:
โโโโ L (int)
โโโโ R (int)
f_winMinLow(L, R)
โโParameters:
โโโโ L (int)
โโโโ R (int)
f_step1_pivots(ph, pl, hiB, lowB, oidSeq, ctx, out, evSeq, ledger, capLedger, capPvt, capEvt, swL, swR, commitBar)
โโParameters:
โโโโ ph (Boundary)
โโโโ pl (Boundary)
โโโโ hiB (array)
โโโโ lowB (array)
โโโโ oidSeq (array)
โโโโ ctx (Ctx)
โโโโ out (array)
โโโโ evSeq (array)
โโโโ ledger (array)
โโโโ capLedger (int)
โโโโ capPvt (int)
โโโโ capEvt (int)
โโโโ swL (int)
โโโโ swR (int)
โโโโ commitBar (bool)
f_step2_sweep(ph, pl, eps, out, evSeq, capEvt, commitBar)
โโParameters:
โโโโ ph (Boundary)
โโโโ pl (Boundary)
โโโโ eps (float)
โโโโ out (array)
โโโโ evSeq (array)
โโโโ capEvt (int)
โโโโ commitBar (bool)
f_step3_reclaim(w, ph, pl, ctx, out, evSeq, capEvt, commitBar)
โโParameters:
โโโโ w (Watch)
โโโโ ph (Boundary)
โโโโ pl (Boundary)
โโโโ ctx (Ctx)
โโโโ out (array)
โโโโ evSeq (array)
โโโโ capEvt (int)
โโโโ commitBar (bool)
f_step4_detect(ph, pl, eps, commitBar)
โโParameters:
โโโโ ph (Boundary)
โโโโ pl (Boundary)
โโโโ eps (float)
โโโโ commitBar (bool)
f_step5_assign(w, ph, pl, ctx, brkUp, brkDn, hiB, lowB, oidSeq, out, evSeq, ledger, capLedger, capEvt, commitBar)
โโParameters:
โโโโ w (Watch)
โโโโ ph (Boundary)
โโโโ pl (Boundary)
โโโโ ctx (Ctx)
โโโโ brkUp (bool)
โโโโ brkDn (bool)
โโโโ hiB (array)
โโโโ lowB (array)
โโโโ oidSeq (array)
โโโโ out (array)
โโโโ evSeq (array)
โโโโ ledger (array)
โโโโ capLedger (int)
โโโโ capEvt (int)
โโโโ commitBar (bool)
Pvt
โโFields:
โโโโ p (series float)
โโโโ sb (series int)
โโโโ st (series int)
โโโโ ct (series int)
Boundary
โโFields:
โโโโ p (series float)
โโโโ sb (series int)
โโโโ st (series int)
โโโโ ct (series int)
โโโโ s (series string)
โโโโ src (series string)
โโโโ r (series string)
โโโโ unb (series int)
โโโโ oid (series int)
Watch
โโFields:
โโโโ on (series bool)
โโโโ dir (series int)
โโโโ lvl (series float)
โโโโ bar (series int)
โโโโ time (series int)
โโโโ id (series int)
โโโโ last (series string)
โโโโ asgSd (series int)
โโโโ asgP (series float)
โโโโ asgAr (series bool)
Ctx
โโFields:
โโโโ bias (series int)
โโโโ lbWinS (series int)
โโโโ lbBrkT (series int)
โโโโ lbId (series int)
โโโโ lbDir (series int)
โโโโ lbAsg (series bool)
โโโโ nlate (series int)
โโโโ nunres (series int)
โโโโ npw (series int)
โโโโ npb (series int)
โโโโ nalt (series int)
โโโโ nboot (series int)
โโโโ nt45 (series int)
โโโโ ninv (series int)
โโโโ zPendSB (series int)
โโโโ zPendDir (series int)
โโโโ zPendAk (series string)
โโโโ zPendOn (series bool)
โโโโ pvTrunc (series int)
โโโโ evTrunc (series int)
โโโโ bndTrunc (series int)
Ev
โโFields:
โโโโ id (series int)
โโโโ k (series string)
โโโโ dir (series int)
โโโโ lvl (series float)
โโโโ aux (series float)
โโโโ st (series int)
โโโโ ct (series int)
โโโโ info (series string)
โโโโ ref (series int)
โโโโ refkind (series string)
BoundaryRecord
โโFields:
โโโโ oid (series int)
โโโโ side (series int)
โโโโ p (series float)
โโโโ st (series int)
โโโโ ct (series int)
โโโโ src (series string)
โโโโ state (series string)
โโโโ termCt (series int)
โโโโ termReason (series string)
โโโโ ordinal (series int)
BreakResult
โโFields:
โโโโ occurred (series bool)
โโโโ ty (series string)
โโโโ dir (series int)
โโโโ evid (series int)
โโโโ brokenP (series float)
โโโโ brokenSB (series int)
โโโโ brokenST (series int)
โโโโ cp (series float)
โโโโ cs (series int)
โโโโ ct (series int)
โโโโ cc (series int)
โโโโ asrc (series string)
โโโโ priorWatchClosed (series bool)
โโโโ priorWatchReason (series string) Perpustakaan

Perpustakaan

Perpustakaan

SMCNexusFactsCoreV2SMCNexusFactsCoreV2 is an open-source, non-visual Pine Script library that maintains confirmed and bounded Smart Money Concepts market facts for use by importing indicators.
The library provides a stateful market-facts engine for swing structure, BOS, CHoCH, MSS, Fair Value Gaps, Order Blocks, liquidity pools, liquidity sweeps, Premium/Discount context and EMA-based context.
It does not draw chart objects, create inputs, request other timeframes, generate alerts, transmit data, calculate trade recommendations or place orders. The importing indicator supplies all chart series and decides how the returned facts are displayed or used.
ORIGINAL CONCEPT AND PURPOSE
The library maintains one consistent, confirmed market-state model instead of calculating unrelated labels independently.
Confirmed swing points become the shared source for:
โข HH, HL, LH and LL classification,
โข market bias,
โข Break of Structure,
โข Change of Character,
โข Market Structure Shift,
โข buy-side and sell-side liquidity pools,
โข Premium and Discount dealing ranges.
Fair Value Gaps and Order Blocks use bounded lifecycle records. The library retains only a limited number of objects for each type and direction, preventing unbounded array growth.
Visual settings are not part of this library. An importing indicator can hide or show its own presentation without changing the underlying facts maintained by Facts Core.
CONFIRMED-ONLY PROCESSING
The importing indicator explicitly tells the library whether the current bar is confirmed.
Canonical state changes occur only when confirmed data is supplied. This includes:
โข new swing confirmation,
โข BOS or CHoCH confirmation,
โข MSS confirmation,
โข creation of FVG and Order Block facts,
โข zone tests and mitigation,
โข liquidity-pool creation and collection,
โข sweep confirmation.
The library does not use future chart data, negative visual offsets to rewrite history or hidden lookahead requests.
MARKET STRUCTURE
The stateful swing engine stores the latest and previous confirmed swing highs and lows.
It classifies confirmed swings as:
โข HH โ Higher High
โข HL โ Higher Low
โข LH โ Lower High
โข LL โ Lower Low
The structure model tracks:
โข latest swing prices,
โข origin bars,
โข swing types,
โข current market bias,
โข consumed structure levels,
โข latest break type and direction,
โข latest MSS direction and bar.
BOS AND CHOCH
A confirmed break can require a candle close beyond the structure level, depending on the supplied configuration.
The current market bias and the direction of the broken swing determine whether the event represents continuation or a Change of Character.
The library preserves the confirmed event level, direction, origin and confirmation bar in the returned snapshot.
MARKET STRUCTURE SHIFT
MSS can require:
โข a confirmed close through structure,
โข a previous opposite bias,
โข a displacement candle,
โข a minimum ATR-based displacement.
These requirements are provided through FactsConfiguration. The library does not silently relax a missing requirement.
FAIR VALUE GAPS
The library detects bullish and bearish three-candle imbalances from caller-supplied OHLC data.
Optional ATR filtering can require a minimum imbalance size.
Each FVG fact can contain:
โข direction,
โข upper and lower boundaries,
โข origin bar and time,
โข confirmation bar,
โข mitigation state,
โข invalidation state,
โข test count,
โข fill percentage,
โข latest test bar,
โข origin volume,
โข origin average volume,
โข origin Premium/Discount location,
โข bounded strength,
โข displacement confirmation.
ORDER BLOCKS
Order Block facts are created from a bounded lookback and can require a confirmed BOS or MSS.
The configuration controls whether candle bodies or full candle ranges define the zone.
Each Order Block uses the same auditable lifecycle metadata as an FVG, including origin, tests, fill, mitigation, invalidation, volume, relative volume context, strength and displacement confirmation.
ZONE LIFECYCLE
A zone can be:
โข available,
โข tested,
โข partially filled,
โข mitigated,
โข invalidated.
The test counter and fill percentage are updated from confirmed interaction with the stored zone boundaries.
The library does not invent missing origin metadata. If a fact cannot be associated with a valid source, the unavailable value remains unavailable.
LIQUIDITY
The library maintains bounded arrays of confirmed swing-high and swing-low liquidity references.
It derives:
โข BSL โ Buy-Side Liquidity,
โข SSL โ Sell-Side Liquidity,
โข EQH โ Equal Highs,
โข EQL โ Equal Lows.
Equal-level classification uses the supplied ATR-based tolerance rather than exact floating-point equality.
Liquidity metadata includes:
โข side and type,
โข level,
โข origin bar,
โข collection state,
โข collection time,
โข sweep type and level.
A pool origin is preserved only when its price is genuinely associated with the originating swing. The library does not transfer unrelated swing metadata to a new liquidity level.
LIQUIDITY SWEEPS
Depending on configuration, a sweep can require price to move beyond the stored pool and close back inside it.
The returned snapshot distinguishes BSL and SSL sweep facts. A sweep is a confirmed market fact, not a BUY or SELL recommendation.
PREMIUM AND DISCOUNT
The library can build a dealing range from confirmed swing extremes.
The returned context can contain:
โข range high,
โข range low,
โข equilibrium,
โข current Premium, Discount or Equilibrium classification.
An unavailable or invalid range remains unavailable rather than using a synthetic fallback.
EMA AND CONTEXT FACTS
The importing indicator supplies the configured fast, medium and slow EMA values together with available higher-timeframe context.
Facts Core returns bounded contextual facts such as:
โข EMA trend state,
โข price relation to EMA values,
โข available higher-timeframe trend and bias context.
The library does not request higher-timeframe data itself. This keeps data ownership and confirmation timing inside the importing indicator.
BOUNDED STATE
The implementation uses explicit limits:
โข maximum six zones for each kind and direction,
โข maximum eight swing references for each side.
This prevents unlimited state growth and makes runtime behavior predictable.
PUBLIC API
Exported records:
โข FactsConfiguration
โข ZoneFact
โข FactsState
โข StructureFacts
โข ZoneFacts
โข LiquidityFacts
โข ContextFacts
โข FactsSnapshot
Exported functions:
โข contractVersion()
โข defaultConfiguration()
โข newState()
โข advance(...)
โข snapshotValid(...)
TYPICAL USAGE
An importing indicator should:
1. Create one persistent FactsState.
2. Create or resolve a FactsConfiguration.
3. Supply confirmed OHLCV, ATR, EMA and available context values to advance().
4. Store the returned state.
5. Read the returned FactsSnapshot.
6. Validate the snapshot with snapshotValid().
7. Present or transport only facts that are actually available.
Conceptual example:
```pine
import AreXoN_/SMCNexusFactsCoreV2/1 as facts
var facts.FactsState state = facts.newState()
facts.FactsConfiguration configuration =
facts.defaultConfiguration()
= facts.advance(
state,
configuration,
barstate.isconfirmed,
bar_index,
time,
open,
high,
low,
close,
volume,
atr14,
emaFast,
emaMedium,
emaSlow,
higherTimeframeTrend,
higherTimeframeBias,
localContext)
state := stateNext
bool validSnapshot = facts.snapshotValid(snapshot)
```
The example is conceptual. The exact function signature in the published source is authoritative. Replace the example import with the exact path assigned by TradingView.
WHY THE CHART IS CLEAN
This is a non-visual market-facts library. It intentionally creates no plots, labels, boxes, lines, tables or chart drawings.
The publication chart is therefore intentionally clean and contains no other indicators or unexplained visual elements. An importing indicator is responsible for visual presentation.
LIMITATIONS
โข Facts are based on the chart OHLCV series supplied by the importer.
โข Swing confirmation necessarily occurs after the configured right-side bars.
โข The library does not provide native bid/ask data, footprint or real order flow.
โข Chart volume may be broker tick volume rather than centralized exchange volume.
โข It does not verify spread, slippage or broker execution.
โข It does not request macroeconomic information.
โข It does not produce trading signals or recommendations.
โข It does not place, modify or close orders.
โข It produces no visual chart output by itself.
Contract version: 1.0.0.
This library is an analytical and software-development component. It is not investment advice, a trading recommendation or an automated trading system. Perpustakaan

SMCNexusTradePlanCoreV2SMCNexusTradePlanCoreV2 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 candidates =
array.new()
// 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 TradingView 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. Perpustakaan

SMCNexusConfigurationCoreV2SMCNexusConfigurationCoreV2 is an open-source, non-visual Pine Script library for resolving deterministic indicator configuration profiles and bounded visibility settings.
The library separates pure configuration decisions from market detection, chart state and presentation code. It does not generate signals, place orders or draw objects.
The importing indicator supplies its saved manual settings, chart timeframe and supported-symbol state. The library returns typed effective configuration records without calling input functions, requesting external timeframes or changing the importing script's saved settings.
ORIGINAL CONCEPT AND PURPOSE
The library implements three explicit configuration modes:
โข MANUAL โ preserves every value supplied by the importing indicator.
โข AUTO โ applies an exact predefined profile only when the supplied symbol and timeframe combination is explicitly supported.
โข HYBRID โ applies automatic values only to individually selected categories while preserving manual values for all other categories.
The implementation does not use nearest-timeframe guessing. An unsupported symbol or timeframe falls back to the supplied manual settings.
Detection parameters and visual settings are resolved separately. This prevents a visibility option from unintentionally disabling the underlying analytical calculation. For example, hiding a market-structure label does not remove the structure state used elsewhere by the importing indicator.
SUPPORTED PROFILE CONTEXT
The profile resolver distinguishes exact chart timeframes:
โข M1
โข M5
โข M15
โข M30
โข H1
โข H4
โข D1
โข W1
The importing indicator decides whether the current symbol is supported. If the symbol or timeframe is unsupported, the automatic profile is not applied.
CONFIGURATION CATEGORIES
The resolved configuration includes separate categories for:
โข swing structure,
โข Market Structure Shift requirements,
โข Fair Value Gap parameters,
โข Order Block parameters,
โข liquidity and sweep parameters,
โข volume-profile range settings,
โข structure visibility,
โข zone visibility,
โข liquidity and Premium/Discount visibility,
โข EMA, pivot and volume-marker visibility,
โข panel and Trade Plan visibility,
โข trendline and volume-profile visibility.
ADAPTIVE GRID RESOLUTION
The library also contains a bounded adaptive-grid resolver for importing scripts that build a volume-profile approximation.
The resolver receives:
โข the manual tick floor,
โข the instrument minimum tick,
โข the current range low and high,
โข the requested target number of bins.
It calculates:
โข whether the result is valid,
โข effective ticks per bin,
โข effective bin size,
โข maximum permitted span,
โข actual span in ticks,
โข applied scale.
The effective tick step is never lower than the supplied manual floor. The resolver increases the step using a power-of-two scale when the requested price span would exceed the bounded target. Invalid or incomplete inputs return an unavailable result instead of an invented value.
PUBLIC API
Typed result records:
โข ProfileContext
โข CoreConfiguration
โข StructureVisibility
โข ZoneVisibility
โข ContextVisibility
โข OverlayVisibility
โข PanelVisibility
โข AuxiliaryVisibility
โข AdaptiveGridResolution
Exported resolvers:
โข resolveAdaptiveGrid(...)
โข resolveProfileContext(...)
โข resolveCoreConfiguration(...)
โข resolveStructureVisibility(...)
โข resolveZoneVisibility(...)
โข resolveContextVisibility(...)
โข resolveOverlayVisibility(...)
โข resolvePanelVisibility(...)
โข resolveAuxiliaryVisibility(...)
INTENDED USE
An importing indicator first creates a ProfileContext. It then passes that context together with its saved manual settings to the required resolver.
Conceptual example:
```pine
import AreXoN_/SMCNexusConfigurationCoreV2/1 as config
config.ProfileContext profile = config.resolveProfileContext(
configurationMode,
supportedSymbol,
timeframe.period,
autoStructure,
autoMss,
autoFvg,
autoOb,
autoLiquidity,
autoVolumeProfile,
autoVisibility)
config.CoreConfiguration effective = config.resolveCoreConfiguration(
profile,
manualSwingLeft,
manualSwingRight,
manualRequireCloseBreak,
manualRequireOppositeBias,
manualRequireDisplacement,
manualDisplacementAtr,
manualFvgCount,
manualFvgAtrFilter,
manualFvgAtrSize,
manualObCount,
manualObLookback,
manualObStructureRequirement,
manualObBodyMode,
manualLiquidityLookback,
manualEqualLevelTolerance,
manualSweepCloseBack,
manualProfileMode,
manualProfileBars)
```
The example import path should be replaced with the exact path assigned by TradingView after publication.
WHY THE CHART IS CLEAN
This is a non-visual configuration 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. An importing indicator is responsible for presenting the resolved settings.
LIMITATIONS
โข Automatic profiles are applied only to exact supported combinations.
โข The library does not optimize settings or claim that a profile is profitable.
โข It does not independently inspect a symbol or identify a broker feed.
โข It does not read live market data.
โข It does not preserve state between executions.
โข It does not place, modify or close orders.
โข It produces no chart output by itself.
This library is a reusable software-development component. It is not investment advice, a trading signal or an automated trading system. Perpustakaan

SMCNexusScoringCoreV2SMCNexusScoringCoreV2 is an open-source, non-visual Pine Script library that calculates a deterministic Smart Money Concepts evidence score from market facts supplied by an importing indicator.
The library does not independently read chart state, request other timeframes, generate trading signals, place orders or draw chart objects. Its purpose is to separate the scoring calculation from detection and presentation code, making every component reusable and independently auditable.
ORIGINAL CONCEPT AND PURPOSE
The library combines twelve bounded Smart Money Concepts evidence components into one normalized 0โ100 result while retaining each individual component in the returned ScoreResult record.
It also provides optional event-age decay for selected structural evidence. This prevents an old BOS, CHoCH, MSS or liquidity sweep from retaining the same influence indefinitely.
The importing indicator is responsible for detecting and confirming market events. This library receives those facts through typed parameters and performs deterministic calculations only. It does not infer missing events or substitute unknown data.
CALCULATION METHOD
The twelve components are:
1. Market Structure Shift
2. Break of Structure
3. Change of Character
4. Fair Value Gap
5. Order Block
6. Liquidity context
7. Liquidity sweep
8. Premium or Discount location
9. Volume state
10. Momentum state
11. Local Smart Money context
12. Primary trend
Each component contributes a bounded value based on the supplied state. The component total is divided by twelve and normalized to a value from 0 to 100.
The resulting descriptive classes are:
โข VERY WEAK
โข WEAK
โข NEUTRAL
โข STRONG
โข ELITE
These classes describe the supplied analytical evidence. They are not trading recommendations and do not predict future performance.
AGE DECAY
When age decay is enabled, the selected structural and sweep components use a linear age factor.
The factor:
โข remains at 1.0 until the configured full-strength age,
โข decreases linearly between the full-strength and zero-strength ages,
โข reaches 0.0 at or beyond the configured zero-strength age.
If the supplied age window is invalid, the calculation fails safely to full strength instead of producing a negative or undefined weight.
PUBLIC API
ScoreResult
The returned record contains:
โข all twelve effective components,
โข effective MSS age factor,
โข effective BOS/CHoCH age factor,
โข effective sweep age factor,
โข component total,
โข normalized score,
โข descriptive class,
โข compact text representation.
calculate(...)
This function accepts typed, confirmed market facts and returns one ScoreResult record.
INTENDED USE
An importing indicator should:
1. Detect and confirm its own market-structure events.
2. Determine its current FVG, Order Block, liquidity, volume, momentum and trend states.
3. Pass those facts to calculate().
4. Read the normalized result or inspect the individual returned components for a complete breakdown.
Conceptual example:
```pine
import AreXoN_/SMCNexusScoringCoreV2/1 as scoring
scoring.ScoreResult result = scoring.calculate(
scoringEnabled,
ageDecayEnabled,
bar_index,
lastMssBar,
lastBreakBar,
lastSweepBar,
structureFullStrengthBars,
structureZeroStrengthBars,
sweepFullStrengthBars,
sweepZeroStrengthBars,
mssDirection,
breakType,
breakDirection,
fvgType,
fvgMitigated,
obType,
obMitigated,
liquidityContext,
sweepType,
premiumDiscountZone,
volumeState,
momentumState,
smartMoneyState,
primaryTrendState)
```
The example import path should be replaced with the exact path assigned by TradingView after publication.
WHY THE CHART IS CLEAN
This is a non-visual calculation library. It intentionally creates no plots, labels, tables, lines or boxes. Visual output is the responsibility of an importing indicator.
The publication chart is therefore intentionally clean and contains no additional indicators or unexplained drawings.
LIMITATIONS
โข Output quality depends on the facts supplied by the importing indicator.
โข The library does not independently verify market events.
โข It does not provide native bid/ask order flow or broker execution data.
โข It does not account for spread, slippage or broker restrictions.
โข It does not place, modify or close orders.
โข It produces no chart output by itself.
โข A score or class is not a guarantee of future market behavior.
This library is an analytical and software-development component. It is not investment advice or an automated trading system. Perpustakaan

TVA_MathLibraryLibrary "TVA_MathLibrary"
f_htfBundle(tf)
โโParameters:
โโโโ tf (simple string)
f_htfBias(c, e20, e50, e200, r, atrv, adxv)
โโParameters:
โโโโ c (float)
โโโโ e20 (float)
โโโโ e50 (float)
โโโโ e200 (float)
โโโโ r (float)
โโโโ atrv (float)
โโโโ adxv (float)
f_stdTrendScore(c, e20, e50, e200, r, adxv)
โโParameters:
โโโโ c (float)
โโโโ e20 (float)
โโโโ e50 (float)
โโโโ e200 (float)
โโโโ r (float)
โโโโ adxv (float)
f_confirmationScore(setupDir, biasW, biasD, bias4H, bias1H)
โโParameters:
โโโโ setupDir (int)
โโโโ biasW (float)
โโโโ biasD (float)
โโโโ bias4H (float)
โโโโ bias1H (float)
f_confluenceScore(alignmentPct, momentumConverge, adxv, volatilityCtx, volumeConfirm)
โโParameters:
โโโโ alignmentPct (float)
โโโโ momentumConverge (float)
โโโโ adxv (float)
โโโโ volatilityCtx (float)
โโโโ volumeConfirm (float)
f_buyProbability(baseBullPct, c, e20, e50, e200, r, macdHist, macdHistPrev, vol, volEma20, distToSupportATR, adxv, adxRising)
โโParameters:
โโโโ baseBullPct (float)
โโโโ c (float)
โโโโ e20 (float)
โโโโ e50 (float)
โโโโ e200 (float)
โโโโ r (float)
โโโโ macdHist (float)
โโโโ macdHistPrev (float)
โโโโ vol (float)
โโโโ volEma20 (float)
โโโโ distToSupportATR (float)
โโโโ adxv (float)
โโโโ adxRising (bool)
f_sellProbability(baseBearPct, c, e20, e50, e200, r, macdHist, macdHistPrev, vol, volEma20, distToResistATR, adxv, adxFallingDown)
โโParameters:
โโโโ baseBearPct (float)
โโโโ c (float)
โโโโ e20 (float)
โโโโ e50 (float)
โโโโ e200 (float)
โโโโ r (float)
โโโโ macdHist (float)
โโโโ macdHistPrev (float)
โโโโ vol (float)
โโโโ volEma20 (float)
โโโโ distToResistATR (float)
โโโโ adxv (float)
โโโโ adxFallingDown (bool)
f_marketRegime(adxv, efficiencyRatio, atr20, atr50, bbWidth, bbWidthEma20)
โโParameters:
โโโโ adxv (float)
โโโโ efficiencyRatio (float)
โโโโ atr20 (float)
โโโโ atr50 (float)
โโโโ bbWidth (float)
โโโโ bbWidthEma20 (float)
f_chopIndex(adxv, diPlus, diMinus, efficiencyRatio, bbWidth, bbWidthEma20)
โโParameters:
โโโโ adxv (float)
โโโโ diPlus (float)
โโโโ diMinus (float)
โโโโ efficiencyRatio (float)
โโโโ bbWidth (float)
โโโโ bbWidthEma20 (float)
f_volatilityClass(atrPercentile, histVolPercentile, trExpansionRatio, bbWidthPercentile)
โโParameters:
โโโโ atrPercentile (float)
โโโโ histVolPercentile (float)
โโโโ trExpansionRatio (float)
โโโโ bbWidthPercentile (float)
f_emaSmooth2(src)
โโParameters:
โโโโ src (float)
f_scoreColor(score, highIsGood)
โโParameters:
โโโโ score (float)
โโโโ highIsGood (bool)
f_gaugeText(score, label)
โโParameters:
โโโโ score (float)
โโโโ label (string)
f_alignmentBar(pct)
โโParameters:
โโโโ pct (float) Perpustakaan

KC Institutional Core LibraryKC Institutional Core Library v1.0
KCInstitutionalCore is a reusable Pine Script v6 utility library created to support structured technical-analysis workflows without duplicating common helper logic across multiple indicators and strategies.
The library provides transparent and independently reusable functions for:
Score normalization and trade-quality grading
Premium, Discount and Equilibrium classification
Risk-to-reward calculation
Risk-based position-size estimation
Timeframe-aware trading-style classification
Adaptive higher-timeframe selection
Directional alignment analysis
Execution-blocker identification
The exported functions are deterministic utilities. They do not generate guaranteed trading signals, predict future price movement or execute trades.
Basic import example
import Kelly_Carter12/KCInstitutionalCore/1 as kc
string grade = kc.scoreToGrade(78)
string style = kc.tradeStyle(timeframe.in_seconds())
= kc.rangeLocation(close, ta.highest(high, 50), ta.lowest(low, 50))
The detailed function documentation below explains every exported function, parameter and return value.
Library "KCInstitutionalCore"
Reusable Pine Script v6 utilities for timeframe context, score grading, premium/discount classification, alignment, risk-to-reward and position-size calculations. Designed as a transparent helper library for indicators and strategies.
clamp(value, minimum, maximum)
โโRestricts a numeric value to the supplied minimum and maximum boundaries.
โโParameters:
โโโโ value (float) : Value to restrict.
โโโโ minimum (float) : Lower boundary.
โโโโ maximum (float) : Upper boundary.
โโReturns: The restricted value.
scoreToGrade(score)
โโConverts a numeric score into a concise quality grade.
โโParameters:
โโโโ score (float) : Score expressed on a 0โ100 scale.
โโReturns: A grade string from AA to D.
normalizeScore(rawScore, maximumScore)
โโNormalizes a raw score to a 0โ100 scale.
โโParameters:
โโโโ rawScore (float) : Current raw score.
โโโโ maximumScore (float) : Maximum possible raw score.
โโReturns: Normalized score from 0 to 100, or na when maximumScore is not positive.
rangeLocation(price, rangeHigh, rangeLow)
โโClassifies the current price inside a supplied dealing range.
โโParameters:
โโโโ price (float) : Current or evaluated price.
โโโโ rangeHigh (float) : Upper boundary of the range.
โโโโ rangeLow (float) : Lower boundary of the range.
โโReturns: A tuple containing PREMIUM, DISCOUNT, or EQUILIBRIUM and the 0โ100 range percentage.
riskReward(entry, stop, target)
โโCalculates reward-to-risk from entry, stop and target prices.
โโParameters:
โโโโ entry (float) : Entry price.
โโโโ stop (float) : Stop-loss price.
โโโโ target (float) : Target price.
โโReturns: Absolute reward-to-risk ratio, or na when the stop distance is zero.
positionSize(accountSize, riskPercent, entry, stop, pointValue)
โโEstimates position size from account risk and stop distance.
โโParameters:
โโโโ accountSize (float) : Account balance or planning capital.
โโโโ riskPercent (float) : Percentage of account risked.
โโโโ entry (float) : Entry price.
โโโโ stop (float) : Stop-loss price.
โโโโ pointValue (float) : Monetary value per price point for one unit.
โโReturns: Estimated units or lots according to the supplied pointValue, or na for invalid inputs.
tradeStyle(chartSeconds)
โโMaps chart duration in seconds to a general planning style.
โโParameters:
โโโโ chartSeconds (float) : Chart timeframe duration in seconds, normally supplied with timeframe.in_seconds().
โโReturns: SCALP, INTRADAY, SWING, or POSITION.
adaptiveTimeframes(chartSeconds)
โโSuggests two broader context timeframes from the chart duration.
โโParameters:
โโโโ chartSeconds (float) : Chart timeframe duration in seconds, normally supplied with timeframe.in_seconds().
โโReturns: A tuple containing primary and secondary context timeframe strings.
alignmentState(localBias, htfBias, mtfBias)
โโSummarizes local, higher-timeframe and multi-timeframe directional agreement.
โโParameters:
โโโโ localBias (int) : Local direction: 1 bullish, -1 bearish, 0 neutral.
โโโโ htfBias (int) : Higher-timeframe direction: 1 bullish, -1 bearish, 0 neutral.
โโโโ mtfBias (int) : Broader alignment direction: 1 bullish, -1 bearish, 0 neutral.
โโReturns: BULL ALIGNED, BEAR ALIGNED, PARTIAL, CONFLICT, or NEUTRAL.
executionBlocker(direction, htfBias, mtfBias, location, structureConfirmed, liquidityConfirmed, newsBlocked)
โโReturns the first material execution blocker in a transparent priority order.
โโParameters:
โโโโ direction (int) : Intended direction: 1 long, -1 short, 0 neutral.
โโโโ htfBias (int) : Higher-timeframe direction: 1 bullish, -1 bearish, 0 neutral.
โโโโ mtfBias (int) : Multi-timeframe direction: 1 bullish, -1 bearish, 0 neutral.
โโโโ location (string) : PREMIUM, DISCOUNT, or EQUILIBRIUM.
โโโโ structureConfirmed (bool) : True when the required structure event is confirmed.
โโโโ liquidityConfirmed (bool) : True when the required liquidity event is confirmed.
โโโโ newsBlocked (bool) : True when a manual news blackout is active.
โโReturns: A concise blocker description, or CLEAR when no listed blocker is active. Perpustakaan

FractalMemoryLib [Jayadev Rana]FractalMemoryLib packages the pattern-memory engine used by the Fractal Memory Projection indicator and the Fractal Memory Strategy so any script can import it.
WHAT IT DOES
The library finds the historical window whose movement shape most resembles the most recent bars (mean squared distance between stdev-normalized log returns), replays what followed that window as a projected close path, and sizes stops and targets adaptively by volatility regime.
EXPORTED FUNCTIONS
logRet(src) - one-bar log return of a series.
bestMatch(src, winLen, scanDepth, gapAhead) - scans up to scanDepth bars back and returns the offset of the most similar window plus a 0-100 similarity score. gapAhead reserves bars after the match for a projection.
analogPath(src, offset, fcLen, scaleF) - array of fcLen projected closes built by replaying the returns that followed the match, rescaled by scaleF (for example current ATR over ATR at the match).
adaptiveR(atrLen, rankLen, base) - volatility-adaptive unit risk: ATR times (base plus its 0-1 percentile rank), plus the rank itself. Call on every bar.
volRegime(volRank) - "Low", "Normal" or "High" label from the rank.
targets(entry, dirSign, unitR, slMult) - stop loss and TP1/TP2/TP3 at 1R, 2R and 3R.
USAGE NOTES
Call adaptiveR on every bar for ta consistency. bestMatch and analogPath are loop-heavy; for display purposes call them on the last bar only, and make sure the chart has at least scanDepth plus gapAhead bars of history. When the library itself is added to a chart it draws a small demo projection line from the best analog.
The analog projection is a statistical reference to a similar past episode, not a prediction, and not financial advice. Perpustakaan

PatternHelpersLibrary "PatternHelpers"
method update(atr, h, l, c, period)
โโNamespace types: WilderAtr
โโParameters:
โโโโ atr (WilderAtr)
โโโโ h (float)
โโโโ l (float)
โโโโ c (float)
โโโโ period (int)
method push(buf, o, h, l, c, t, idx, max_len)
โโNamespace types: CandleBuffer
โโParameters:
โโโโ buf (CandleBuffer)
โโโโ o (float)
โโโโ h (float)
โโโโ l (float)
โโโโ c (float)
โโโโ t (int)
โโโโ idx (int)
โโโโ max_len (int)
method gap_candles(buf, prev_end_idx, next_start_idx)
โโNamespace types: CandleBuffer
โโParameters:
โโโโ buf (CandleBuffer)
โโโโ prev_end_idx (int)
โโโโ next_start_idx (int)
quantile_rail(vals, upper)
โโParameters:
โโโโ vals (array)
โโโโ upper (bool)
has_acceptable_coverage(values, upper_bounds, lower_bounds)
โโParameters:
โโโโ values (array)
โโโโ upper_bounds (array)
โโโโ lower_bounds (array)
has_acceptable_coverage_const(values, upper, lower)
โโParameters:
โโโโ values (array)
โโโโ upper (float)
โโโโ lower (float)
has_low_directional_drift(closes, upper, lower)
โโParameters:
โโโโ closes (array)
โโโโ upper (float)
โโโโ lower (float)
has_balanced_rotation(values, shape_width)
โโParameters:
โโโโ values (array)
โโโโ shape_width (float)
has_no_dominant_run(values, shape_width)
โโParameters:
โโโโ values (array)
โโโโ shape_width (float)
ols_regression(y, x, origin_x)
โโParameters:
โโโโ y (array)
โโโโ x (array)
โโโโ origin_x (int)
residual_rail(highs_or_lows, indices, intercept, slope, origin_idx, upper)
โโParameters:
โโโโ highs_or_lows (array)
โโโโ indices (array)
โโโโ intercept (float)
โโโโ slope (float)
โโโโ origin_idx (int)
โโโโ upper (bool)
WilderAtr
โโFields:
โโโโ prev_close (series float)
โโโโ atr_val (series float)
โโโโ count (series int)
CandleBuffer
โโFields:
โโโโ opens (array)
โโโโ highs (array)
โโโโ lows (array)
โโโโ closes (array)
โโโโ times (array)
โโโโ indices (array)
โโโโ start_idx (series int) Perpustakaan

Perpustakaan

Perpustakaan

Perpustakaan

Perpustakaan

Perpustakaan

AssetCorrelationUtilsAssetCorrelationUtils
Auto-detection library for correlated asset pairings across futures, CFD, and crypto markets. Given any chart, returns the correct secondary and tertiary (and optionally quaternary) tickers for multi-asset divergence analysis, along with inversion flags and asset-category metadata.
Designed to eliminate the boilerplate of hardcoded ticker lists and manual "if EURUSD then GBPUSD" branching in every indicator that needs correlated data.
What it does
Consumer scripts call one function โ resolveCurrentChart() โ and receive a fully resolved AssetConfig object describing the current chart's correlated pair or triad. The library handles:
Symbol root extraction from full ticker IDs (with expiry suffixes, exchange prefixes, micro variants)
Asset category routing (futures / CFD / crypto branches)
Family-specific triad or dyad selection
Inversion detection (e.g. 6C inverse of USDCAD, DXY inverse of EUR/GBP)
Futures session and back-adjustment modifiers
Optional GXT mode for metals (currency-cross triads on Gold/Silver)
Optional Quad mode for metals (four-leg configurations)
Micro contracts always resolve to their higher-volume full-size correlated partners โ MNQ correlates against ES/YM, not MES/MYM โ matching the "trade the micros, read the majors" convention.
Supported asset classes
Futures
Indices: NQ, ES, YM, RTY + micros (MNQ, MES, MYM, M2K)
Metals: GC, SI, HG + micros (MGC, SIL, MHG)
Forex: 6E, 6B, 6A, 6N, 6C + micros (M6E, M6B, M6A, M6C)
Energy: CL, RB, HO + micros (MCL, MRB, MHO)
Treasury: ZB, ZF, ZN
Crypto: BTC, ETH + micros (MBT, MET)
CFD / Spot
Forex: EURUSD, GBPUSD, DXY, USDJPY, USDCHF, USDCAD
Metals: XAUUSD, XAGUSD, COPPER + cross-pairs (XAUEUR, XAUGBP, XAGEUR, XAGGBP)
Indices: NAS100, SP500, DJ30
EU Stocks: GER40, EU50 (dyad only)
Crypto (spot / perp)
Major: BTC, ETH, SOL, XRP
Alt: ZEC, DOGE, ADA, BNB, TAO
All routed via BINANCE perpetual (.P) pairs for consistent OHLC quality
Core functions
resolveCurrentChart(gxtMode = false, quadMode = false)
The one-liner entry point for most consumers. Wraps resolveAssets() with sensible defaults (uses syminfo.ticker, syminfo.tickerid, syminfo.type, syminfo.session, back-adjustment on).
resolveAssets(ticker, tickerId, assetType, session, useBackadjust, gxtMode, quadMode)
The full-control entry point. Same detection logic, but with explicit control over back-adjustment and session modification โ useful for indicators with a strategy toggle (e.g. RTH vs ETH sessions).
Category detectors
detectIndicesFutures(ticker)
detectMetalsFutures(ticker) / detectMetalsFuturesGxt(ticker) / detectMetalsFuturesQuad(ticker)
detectForexFutures(ticker) / detectCADFutures(ticker)
detectEnergyFutures(ticker)
detectTreasuryFutures(ticker)
detectCryptoFutures(ticker)
detectForexCFD(ticker, tickerId)
detectCrypto(ticker, tickerId)
detectMetalsCFD(ticker, tickerId) / detectMetalsCFDGxt(ticker, tickerId) / detectMetalsCFDQuad(ticker, tickerId)
detectIndicesCFD(ticker, tickerId)
detectEUStocks(ticker, tickerId)
Each returns an AssetPairing โ usable directly if you want to bypass the automatic category routing.
Resolution helpers
resolveTriad(chartTickerId, pairing) โ returns primary + secondary + tertiary with inversion flags
resolveDyad(chartTickerId, pairing) โ returns primary + secondary for two-asset configs
resolveQuad(chartTickerId, pairing) โ returns four-asset config with inversion flags
Utility functions
applySessionModifierWithBackadjust(ticker, session) / applySessionModifierNoBackadjust(ticker, session) โ apply ticker.modify with back-adjustment on or off
isTriadMode(pairing) โ check whether a pairing has a valid tertiary
getAssetTicker(tickerId) โ extract the clean ticker string from a full ticker ID
Fallback
getDefaultFallback(tickerId) โ returns a pairing with the chart ticker as primary and empty secondaries. Used automatically when no category matches.
Return types
AssetConfig
detected (bool) โ true if the chart asset was recognized
isTriadMode (bool) โ true if 3 assets resolved, false for dyad
isQuadMode (bool) โ true if 4 assets resolved
primary (string) โ resolved primary ticker ID
secondary (string) โ resolved secondary ticker ID
tertiary (string) โ resolved tertiary ticker ID (empty for dyad)
quaternary (string) โ resolved quaternary ticker ID (empty unless quad mode)
invertSecondary (bool)
invertTertiary (bool)
invertQuaternary (bool)
assetCategory (string) โ category tag (e.g. "index_futures", "metal_cfd_gxt")
AssetPairing
Internal pairing structure used by detector functions. Consumers rarely construct this directly, but resolveTriad / resolveDyad / resolveQuad accept it if you're bypassing the auto-routing.
Quick start
import I_quacker_I/AssetCorrelationUtils/7 as AC
AC.AssetConfig config = AC.resolveCurrentChart()
string secondary = config.secondary
string tertiary = config.tertiary
bool inv2 = config.invertSecondary
bool inv3 = config.invertTertiary
bool detected = config.detected
For metals with currency-cross triads:
AC.AssetConfig config = AC.resolveCurrentChart(true)
// On Gold: secondary = "FOREXCOM:XAUEUR", tertiary = "FOREXCOM:XAUGBP"
// On Copper or non-metals: identical to resolveCurrentChart(false)
Full integration patterns (Off / Auto / Manual tri-state, explicit back-adjust control, and manual pairing) are documented inline in the library source.
Design notes
Robust ticker matching. All detectors use str.contains() on the root symbol, so any ticker format is recognized โ bare (NQ), continuous (NQ1!), or dated with expiry (NQZ2025). Exchange prefixes are ignored during detection.
Consistent inversion semantics. DXY as the third leg of USD-base forex triads is marked inverted (rises when the pair falls). 6C as USDCAD's futures counterpart is fully inverted. Micros carry their parent's inversion flags unchanged.
Category tags. Every resolved AssetConfig carries an assetCategory string ("index_futures", "metal_cfd_gxt", "crypto", "fallback", etc.). Useful for consumer scripts that want to conditionally enable features per category (e.g. "only compute GXT confluence on metals").
Fallback safety. When no category matches, the library returns the chart ticker as primary with empty secondary / tertiary, detected = false, and assetCategory = "fallback". Consumer scripts should check detected before assuming correlated data is available.
Credits
Original library concept โ @fstarcapital
Modifications and extensions โ @I_quacker_I
Crypto remapped to BINANCE .P perpetuals
Micro contracts always correlate against higher-volume mini/full contracts
AUD/NZD forex futures family (6A, M6A, 6N)
GXT mode for metals (currency-cross triads)
Quad mode for four-leg metal configurations
Crypto tertiary swapped from TOTAL3 (market-cap index, no clean OHLC) to XRP (tradeable asset with proper sweep behavior)
License: Mozilla Public License 2.0 Perpustakaan

Perpustakaan

OhMyHtfLibraryLibrary "OhMyHtfLibrary"
HTF candle platform: timeframe alignment, profiles, and (future) packed OHLC / draw helpers. Import as `import daggerok/OhMyHtfLibrary/1 as omhl`. Sweep/OB domain โ future `OhMyHtfSweepLibrary` (`omhsl`).
resolveHtfContext(chart_tf_seconds, default_htf, default_candle_count, align_ctf_max_seconds, align_htf, align_enabled, profile_ctf_exact_seconds, profile_htf, profile_enabled, profile_candle_counts)
โโResolves HTF string, enable flag, and candle count from Timeframes Alignment + Profiles.
TFA: first alignment row where `chart_tf_seconds <= align_ctf_max_seconds ` wins.
Profiles: first enabled row where `chart_tf_seconds == profile_ctf_exact_seconds ` overrides TFA.
โโParameters:
โโโโ chart_tf_seconds (int) : Chart timeframe in seconds.
โโโโ default_htf (string) : Fallback HTF when no alignment rule matches.
โโโโ default_candle_count (int) : Default HTF candle count (HTF Candles input).
โโโโ align_ctf_max_seconds (array) : Upper-bound CTF seconds per TFA row (length 14).
โโโโ align_htf (array) : HTF string per TFA row.
โโโโ align_enabled (array) : Enabled flag per TFA row.
โโโโ profile_ctf_exact_seconds (array) : Exact chart TF seconds per profile row (length 12).
โโโโ profile_htf (array) : HTF string per profile row.
โโโโ profile_enabled (array) : Profile row enabled flags.
โโโโ profile_candle_counts (array) : Candle count per profile row.
โโReturns: `HtfContext` with resolved settings.
HtfContext
โโResolved HTF timeframe settings for the current chart.
โโFields:
โโโโ htf (series string) : Higher timeframe string for `request.security` and draw logic.
โโโโ is_enabled (series bool) : Whether HTF features are active for this chart TF (TFA enable flag or profile override).
โโโโ candle_count (series int) : Number of HTF candles to display (profile may override default).
โโโโ profile_override (series bool) : True when a profile row matched (exact CTF). Perpustakaan

Perpustakaan

lib_fvgLibrary "lib_fvg"
Fair Value Gap engine โ detection, testing/inversion lifecycle, HTF nesting filters, entry-candidate selection, stop-loss derivation, and FVG drawing โ extracted 1:1 from rewrite_strategy.pine.
method equals(this, other)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
โโโโ other (FVG)
method remove(this, item)
โโNamespace types: array
โโParameters:
โโโโ this (array)
โโโโ item (FVG)
method check_nested_in(this, htf_fvg, check_nested, check_untested, check_nearby, nearby_threshold, check_newer_ltf)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
โโโโ htf_fvg (FVG)
โโโโ check_nested (bool)
โโโโ check_untested (bool)
โโโโ check_nearby (bool)
โโโโ nearby_threshold (float)
โโโโ check_newer_ltf (bool)
method distance_to_price_post_inverse(this, price)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
โโโโ price (float)
method is_higher_tf_or_closer_to_price_than(this, other)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
โโโโ other (FVG)
method get_stop_loss(this, entry_price, session_extreme, enable_sl_at_fvg_created_swing_point, trail_session_level_tight_threshold)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
โโโโ entry_price (float)
โโโโ session_extreme (float)
โโโโ enable_sl_at_fvg_created_swing_point (bool)
โโโโ trail_session_level_tight_threshold (float)
method delete_bar(this)
โโNamespace types: Bar
โโParameters:
โโโโ this (Bar)
method delete_fvg(this)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
log_entry_rejection(enable_log, fvg, reason, smt, note)
โโParameters:
โโโโ enable_log (bool)
โโโโ fvg (FVG)
โโโโ reason (series EntryFilterReason)
โโโโ smt (SMT type from Danieltrade29292/lib_smt/1)
โโโโ note (string)
method invalidate_fvg(this, fvg, reason, entry_block_reason, lifecycle)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ fvg (FVG)
โโโโ reason (series FVGFilterReason)
โโโโ entry_block_reason (series EntryFilterReason)
โโโโ lifecycle (series FVGLifecycle)
method add_fvg(this, fvg, enable_single_fvg_per_tf)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ fvg (FVG)
โโโโ enable_single_fvg_per_tf (bool)
method detect_fvg(this, tf, tf_id, t2, h2, l2, h1, l1, h0, l0, min_gap_size, fvg_deprecation_period, enable_single_fvg_per_tf)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ tf (string)
โโโโ tf_id (int)
โโโโ t2 (int)
โโโโ h2 (float)
โโโโ l2 (float)
โโโโ h1 (float)
โโโโ l1 (float)
โโโโ h0 (float)
โโโโ l0 (float)
โโโโ min_gap_size (float)
โโโโ fvg_deprecation_period (int)
โโโโ enable_single_fvg_per_tf (bool)
method invalidate_all_of_direction(this, fvg_is_bullish, reason)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ fvg_is_bullish (bool)
โโโโ reason (series FVGFilterReason)
method invalidate_fvgs_inversed_pre_smt(this, smt_buffer, enable_log)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ smt_buffer (SMTBuffer type from Danieltrade29292/lib_smt/1)
โโโโ enable_log (bool)
method try_park_in(this, htf_pool, check_nested, check_untested, check_nearby, nearby_threshold, check_newer_ltf)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
โโโโ htf_pool (array)
โโโโ check_nested (bool)
โโโโ check_untested (bool)
โโโโ check_nearby (bool)
โโโโ nearby_threshold (float)
โโโโ check_newer_ltf (bool)
method update_htf_relations(this, enable_filter_by_full_nest_in_HTF_fvg, enable_filter_by_untested, enable_filter_by_edge_nearby_HTF_fvg, nearby_HTF_threshold, enable_filter_by_newer_LTF_fvg)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ enable_filter_by_full_nest_in_HTF_fvg (bool)
โโโโ enable_filter_by_untested (bool)
โโโโ enable_filter_by_edge_nearby_HTF_fvg (bool)
โโโโ nearby_HTF_threshold (float)
โโโโ enable_filter_by_newer_LTF_fvg (bool)
method update_fvgs(this, tf2, tf2_updated, fvg2_o, fvg2_h, fvg2_l, fvg2_c, tf3, tf3_updated, fvg3_o, fvg3_h, fvg3_l, fvg3_c, tf4, tf4_updated, fvg4_o, fvg4_h, fvg4_l, fvg4_c, min_inversion_distance, max_inversion_distance, tested_by_mode, max_tests_before_inverse)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ tf2 (string)
โโโโ tf2_updated (bool)
โโโโ fvg2_o (float)
โโโโ fvg2_h (float)
โโโโ fvg2_l (float)
โโโโ fvg2_c (float)
โโโโ tf3 (string)
โโโโ tf3_updated (bool)
โโโโ fvg3_o (float)
โโโโ fvg3_h (float)
โโโโ fvg3_l (float)
โโโโ fvg3_c (float)
โโโโ tf4 (string)
โโโโ tf4_updated (bool)
โโโโ fvg4_o (float)
โโโโ fvg4_h (float)
โโโโ fvg4_l (float)
โโโโ fvg4_c (float)
โโโโ min_inversion_distance (float)
โโโโ max_inversion_distance (float)
โโโโ tested_by_mode (series FVGTestedByMode)
โโโโ max_tests_before_inverse (int)
method find_next_best_waiting_fvgs(this, smt_buffer)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ smt_buffer (SMTBuffer type from Danieltrade29292/lib_smt/1)
method find_entry_candidate_fvg(this, smt_buffer, enable_filter_by_inversion_bar_close_in_untested_HTF_fvg, enable_log)
โโNamespace types: FVGBuffer
โโParameters:
โโโโ this (FVGBuffer)
โโโโ smt_buffer (SMTBuffer type from Danieltrade29292/lib_smt/1)
โโโโ enable_filter_by_inversion_bar_close_in_untested_HTF_fvg (bool)
โโโโ enable_log (bool)
method draw_bar(this, is_bullish, bgcolor, border_color, labelcolor, txt, show_box)
โโNamespace types: Bar
โโParameters:
โโโโ this (Bar)
โโโโ is_bullish (bool)
โโโโ bgcolor (color)
โโโโ border_color (color)
โโโโ labelcolor (color)
โโโโ txt (string)
โโโโ show_box (bool)
method draw_fvg(this, color_bull, color_bear, debug)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
โโโโ color_bull (color)
โโโโ color_bear (color)
โโโโ debug (bool)
method draw_fvgs(this, color_bull, color_bear, debug)
โโNamespace types: array
โโParameters:
โโโโ this (array)
โโโโ color_bull (color)
โโโโ color_bear (color)
โโโโ debug (bool)
method draw_entry_fvg(this, color_bull, color_bear, debug)
โโNamespace types: FVG
โโParameters:
โโโโ this (FVG)
โโโโ color_bull (simple color)
โโโโ color_bear (simple color)
โโโโ debug (bool)
method delete_fvgs(this)
โโNamespace types: array
โโParameters:
โโโโ this (array)
Bar
โโFields:
โโโโ o (series float)
โโโโ h (series float)
โโโโ l (series float)
โโโโ c (series float)
โโโโ top (series float)
โโโโ btm (series float)
โโโโ t_open (series int)
โโโโ i_open (series int)
โโโโ t_close (series int)
โโโโ i_close (series int)
โโโโ bar_box (series box)
โโโโ bar_label (series label)
FVG
โโFields:
โโโโ is_bullish_original (series bool)
โโโโ is_bullish_post_inverse (series bool)
โโโโ tf (series string)
โโโโ tf_id (series int)
โโโโ top_left (chart.point)
โโโโ bottom_right (chart.point)
โโโโ hh (series float)
โโโโ ll (series float)
โโโโ deprecate_at (series int)
โโโโ sl_level (series float)
โโโโ is_active (series bool)
โโโโ test_count (series int)
โโโโ first_test_idx (series int)
โโโโ is_inversed (series bool)
โโโโ has_touched (series bool)
โโโโ fvg_box (series box)
โโโโ tooltip_label (series label)
โโโโ hidden (series bool)
โโโโ draw_signal_inversed (series bool)
โโโโ draw_signal_text (series bool)
โโโโ draw_signal_highlight (series bool)
โโโโ draw_signal_set_candidate (series bool)
โโโโ draw_signal_reset_candidate (series bool)
โโโโ fill_state (series FVGFillState)
โโโโ lifecycle (series FVGLifecycle)
โโโโ filter_reason (series FVGFilterReason)
โโโโ entry_filter_reason (series EntryFilterReason)
โโโโ tf_inversion_bar (Bar)
โโโโ inversion_idx (series int)
FVGBuffer
โโFields:
โโโโ items (array)
โโโโ inversed (array)
โโโโ invalidated (array) Perpustakaan

lib_smtLibrary "lib_smt"
SMT divergence + session detection/lifecycle, SMT buffers, premium/discount zones, and their on-chart drawing โ extracted 1:1 from rewrite_strategy.pine.
method equals(this, other)
โโNamespace types: SMT
โโParameters:
โโโโ this (SMT)
โโโโ other (SMT)
method delete_smt(this)
โโNamespace types: SMT
โโParameters:
โโโโ this (SMT)
method delete_smts(this)
โโNamespace types: array
โโParameters:
โโโโ this (array)
method replace(this, value)
โโNamespace types: array
โโParameters:
โโโโ this (array)
โโโโ value (Session)
method replace(sess, idx, value, remove_buffer)
โโNamespace types: array
โโParameters:
โโโโ sess (array)
โโโโ idx (int)
โโโโ value (Session)
โโโโ remove_buffer (array)
method reset(this)
โโNamespace types: SessionSignals
โโParameters:
โโโโ this (SessionSignals)
method reset(this)
โโNamespace types: SessionLevel
โโParameters:
โโโโ this (SessionLevel)
method reset(this)
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
method invalidate_smt(this, smt, reason)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ smt (SMT)
โโโโ reason (series SMTFilterReason)
method invalidate_session(this, sess, reason)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ sess (Session)
โโโโ reason (series SMTFilterReason)
method set_intra(this, smt)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ smt (SMT)
method reset_intra(this, reason, sess, reset_bull, reset_bear)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ reason (series SMTFilterReason)
โโโโ sess (Session)
โโโโ reset_bull (bool)
โโโโ reset_bear (bool)
method invalidate_all_daily_smts(this, reason)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ reason (series SMTFilterReason)
method invalidate_all_session_smts(this, is_bullish, reason)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ is_bullish (bool)
โโโโ reason (series SMTFilterReason)
method invalidate_entry_daily_smt(this, entry_smt, reason)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ entry_smt (SMT)
โโโโ reason (series SMTFilterReason)
method invalidate_by_detected_session_id(this, id, reason)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ id (int)
โโโโ reason (series SMTFilterReason)
method invalidate_swept_sessions(this, session_signals, overflow_buffer)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ session_signals (SessionSignals)
โโโโ overflow_buffer (array)
method add_smt(this, smt)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ smt (SMT)
method update_smt(this, other_high, other_low, smt_buffer, enable_invalidation_by_distance, invalidation_dist_chart_led, invalidation_dist_other_led)
โโNamespace types: SMT
โโParameters:
โโโโ this (SMT)
โโโโ other_high (float)
โโโโ other_low (float)
โโโโ smt_buffer (SMTBuffer)
โโโโ enable_invalidation_by_distance (bool)
โโโโ invalidation_dist_chart_led (float)
โโโโ invalidation_dist_other_led (float)
method update_smts(this, other_high, other_low, enable_invalidation_by_distance, invalidation_dist_chart_led, invalidation_dist_other_led)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ other_high (float)
โโโโ other_low (float)
โโโโ enable_invalidation_by_distance (bool)
โโโโ invalidation_dist_chart_led (float)
โโโโ invalidation_dist_other_led (float)
method update_session_level_sweeps(this, other_high, other_low)
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
โโโโ other_high (float)
โโโโ other_low (float)
method detect_smt(this, smt_h1, smt_l1, smt_c1, smt_other_h1, smt_other_l1, is_smt_tf_new_bar, smt_buffer, active_session_id, smt_min_age, is_intra, is_blocked_intra_smt_bull, is_blocked_intra_smt_bear, timeout_intra, touch_tolerance, intra_min_swing_age)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
session.detect_smt โ check if chart/other has swept H or L
ยง2.2.1 Level SMT Detection / ยง2.2.2 Daily SMT Detection / ยง2.2.3 Intra SMT Detection
is_intra=true โ called on live active session (ยง2.2.3); uses running H/L, equal high/low counts
is_intra=false โ called on archived session (ยง2.2.1/ยง2.2.2); levels are fixed at capture time
active_session_id: session currently open, stored as detected_session_id on new SMTs
so ยง2.3.2 London-detected invalidation can filter correctly on NY open
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
โโโโ smt_h1 (float)
โโโโ smt_l1 (float)
โโโโ smt_c1 (float)
โโโโ smt_other_h1 (float)
โโโโ smt_other_l1 (float)
โโโโ is_smt_tf_new_bar (bool)
โโโโ smt_buffer (SMTBuffer)
โโโโ active_session_id (int)
โโโโ smt_min_age (int)
โโโโ is_intra (bool)
โโโโ is_blocked_intra_smt_bull (bool)
โโโโ is_blocked_intra_smt_bear (bool)
โโโโ timeout_intra (int)
โโโโ touch_tolerance (float)
โโโโ intra_min_swing_age (int)
method detect_smts(this, signals, smt_h1, smt_l1, smt_c1, smt_other_h1, smt_other_l1, is_smt_tf_new_bar, smt_buffer, active_session_id, smt_min_age, touch_tolerance)
โโNamespace types: array
โโParameters:
โโโโ this (array)
โโโโ signals (SessionSignals)
โโโโ smt_h1 (float)
โโโโ smt_l1 (float)
โโโโ smt_c1 (float)
โโโโ smt_other_h1 (float)
โโโโ smt_other_l1 (float)
โโโโ is_smt_tf_new_bar (bool)
โโโโ smt_buffer (SMTBuffer)
โโโโ active_session_id (int)
โโโโ smt_min_age (int)
โโโโ touch_tolerance (float)
method has_active_daily_smt(this, seeks_bullish)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ seeks_bullish (bool)
method find_best_smt_by_prio(this, minimum_prio, seeks_bullish)
โโNamespace types: array
โโParameters:
โโโโ this (array)
โโโโ minimum_prio (int)
โโโโ seeks_bullish (bool)
method find_best_smt_by_direction(this, intra_smts_enabled, seeks_bullish)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ intra_smts_enabled (bool)
โโโโ seeks_bullish (bool)
method update_best_smts(this, pd_zone, intra_smts_enabled, allow_bullish_intra_smt_post_cutoff_if_has_daily_smt_active, allow_bearish_intra_smt_post_cutoff_if_has_daily_smt_active)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ pd_zone (int)
โโโโ intra_smts_enabled (bool)
โโโโ allow_bullish_intra_smt_post_cutoff_if_has_daily_smt_active (bool)
โโโโ allow_bearish_intra_smt_post_cutoff_if_has_daily_smt_active (bool)
method rotate(this, sess, max)
โโNamespace types: array
โโParameters:
โโโโ this (array)
โโโโ sess (Session)
โโโโ max (int)
method add_session(this, sess, overflow_buffer)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ sess (Session)
โโโโ overflow_buffer (array)
method evict_consumed_days(this, overflow_buffer, max_history_days)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ overflow_buffer (array)
โโโโ max_history_days (simple int)
method clear_invalidated_smts(this, keep_level, keep_intra, keep_reason)
โโNamespace types: SMTBuffer
โโParameters:
โโโโ this (SMTBuffer)
โโโโ keep_level (bool)
โโโโ keep_intra (bool)
โโโโ keep_reason (bool)
method archive(this)
โโNamespace types: SessionLevel
โโParameters:
โโโโ this (SessionLevel)
method archive(this)
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
method update_levels(this, is_smt_tf_new_bar, other_high, other_low, smt_t1, smt_h1, smt_l1, smt_other_h1, smt_other_l1)
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
โโโโ is_smt_tf_new_bar (bool)
โโโโ other_high (float)
โโโโ other_low (float)
โโโโ smt_t1 (int)
โโโโ smt_h1 (float)
โโโโ smt_l1 (float)
โโโโ smt_other_h1 (float)
โโโโ smt_other_l1 (float)
method update_session(this, signals, smt_buffer, new_day, other_high, other_low, smt_t1, smt_h1, smt_l1, smt_c1, smt_other_h1, smt_other_l1, is_smt_tf_new_bar, smt_min_age, timeout_intra, in_any_no_intra_smt_zone, enable_block_intra_smts_pre_high_prio_sweep, previous_session, intra_min_swing_age)
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
โโโโ signals (SessionSignals)
โโโโ smt_buffer (SMTBuffer)
โโโโ new_day (bool)
โโโโ other_high (float)
โโโโ other_low (float)
โโโโ smt_t1 (int)
โโโโ smt_h1 (float)
โโโโ smt_l1 (float)
โโโโ smt_c1 (float)
โโโโ smt_other_h1 (float)
โโโโ smt_other_l1 (float)
โโโโ is_smt_tf_new_bar (bool)
โโโโ smt_min_age (int)
โโโโ timeout_intra (int)
โโโโ in_any_no_intra_smt_zone (bool)
โโโโ enable_block_intra_smts_pre_high_prio_sweep (bool)
โโโโ previous_session (Session)
โโโโ intra_min_swing_age (int)
method draw_session(this, show_chart, show_panel)
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
โโโโ show_chart (bool)
โโโโ show_panel (bool)
method draw_session_consumed(this)
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
method delete(this)
โโNamespace types: Session
โโParameters:
โโโโ this (Session)
method delete(this)
โโNamespace types: array
โโParameters:
โโโโ this (array)
method register(this, enabled, session, _fill_color, _text, _text_color, _border_color, prio, id, is_daily, is_session, enable_intra_smts, is_no_intra_smt_zone, smt_timeout, strategy_config)
โโNamespace types: array
โโParameters:
โโโโ this (array)
โโโโ enabled (bool)
โโโโ session (string)
โโโโ _fill_color (color)
โโโโ _text (string)
โโโโ _text_color (color)
โโโโ _border_color (color)
โโโโ prio (int)
โโโโ id (int)
โโโโ is_daily (bool)
โโโโ is_session (bool)
โโโโ enable_intra_smts (bool)
โโโโ is_no_intra_smt_zone (bool)
โโโโ smt_timeout (int)
โโโโ strategy_config (StrategyConfig)
method short_id(this)
โโNamespace types: SMT
โโParameters:
โโโโ this (SMT)
method label_text(this, other_ticker, include_filter_reason, is_leader)
โโNamespace types: SMT
โโParameters:
โโโโ this (SMT)
โโโโ other_ticker (string)
โโโโ include_filter_reason (bool)
โโโโ is_leader (bool)
method draw_smt(this, other_ticker, show_label_leader, show_label_follower, verbose)
โโNamespace types: SMT
โโParameters:
โโโโ this (SMT)
โโโโ other_ticker (string)
โโโโ show_label_leader (bool)
โโโโ show_label_follower (bool)
โโโโ verbose (bool)
method draw_smts(this, other_ticker, show_label_leader, show_label_follower, show_filter_reason)
โโNamespace types: array
โโParameters:
โโโโ this (array)
โโโโ other_ticker (string)
โโโโ show_label_leader (bool)
โโโโ show_label_follower (bool)
โโโโ show_filter_reason (bool)
get_pd_range(enable, bars_lookback, new_hour)
โโParameters:
โโโโ enable (simple bool)
โโโโ bars_lookback (int)
โโโโ new_hour (bool)
draw_pd(new_hour, pd_start, pd_high, pd_equilibrium, pd_low)
โโParameters:
โโโโ new_hour (bool)
โโโโ pd_start (int)
โโโโ pd_high (float)
โโโโ pd_equilibrium (float)
โโโโ pd_low (float)
SMT
โโFields:
โโโโ detected_session_id (series int)
โโโโ leader (series int)
โโโโ leader_level (chart.point)
โโโโ sweep (chart.point)
โโโโ follow_level (chart.point)
โโโโ session_id (series int)
โโโโ prio (series int)
โโโโ is_bullish (series bool)
โโโโ deprecate_at (series int)
โโโโ detection_bar (series int)
โโโโ detection_close (series float)
โโโโ valid_from (series int)
โโโโ invalidated (series bool)
โโโโ filter_reason (series SMTFilterReason)
โโโโ leader_line (series line)
โโโโ leader_label (series label)
โโโโ follow_line (series line)
โโโโ follow_intermediate_line (series line)
โโโโ follow_label (series label)
โโโโ smt_color (series color)
โโโโ draw_remove_highlight (series bool)
โโโโ used_for_trade (series bool)
โโโโ trade_end_time (series int)
SessionLevel
โโtracks session H/L
โโFields:
โโโโ chart (chart.point)
โโโโ other (chart.point)
โโโโ chart_smt_tf (chart.point)
โโโโ other_smt_tf (chart.point)
โโโโ is_consumed (series bool)
โโโโ smt (SMT)
StrategyConfig
โโFields:
โโโโ big_win_threshold (series float)
โโโโ cutoff_hour (series int)
โโโโ cutoff_tz (series string)
โโโโ cutoff_mode (series SessionCutoffMode)
โโโโ max_losses (series int)
โโโโ max_wins (series int)
Session
โโFields:
โโโโ id (series int)
โโโโ prio (series int)
โโโโ timeout (series int)
โโโโ session (series string)
โโโโ h (SessionLevel)
โโโโ l (SessionLevel)
โโโโ _fill_color (series color)
โโโโ _text (series string)
โโโโ _text_color (series color)
โโโโ _border_color (series color)
โโโโ is_daily (series bool)
โโโโ is_session (series bool)
โโโโ is_no_intra_smt_zone (series bool)
โโโโ enable_intra_smts (series bool)
โโโโ strategy_config (StrategyConfig)
โโโโ start_time (series int)
โโโโ end_time (series int)
โโโโ cutoff_at (series int)
โโโโ is_active (series bool)
โโโโ is_consumed (series bool)
โโโโ box_chart (series box)
โโโโ box_other (series box)
โโโโ mean_sum (series float)
โโโโ mean_count (series float)
โโโโ mean (series float)
โโโโ is_any_low_swept (series bool)
โโโโ is_any_high_swept (series bool)
โโโโ draw_signal_consumed (series bool)
โโโโ tooltip_chart (series label)
โโโโ tooltip_other (series label)
SessionSignals
โโFields:
โโโโ signal_session_started (series int)
โโโโ signal_session_ending (series int)
โโโโ signal_session_ended (series int)
โโโโ signal_no_intra_smt_zone_started (series int)
โโโโ signal_no_intra_smt_zone_ending (series int)
โโโโ signal_no_intra_smt_zone_ended (series int)
โโโโ signal_intra_smt_h (series int)
โโโโ signal_intra_smt_l (series int)
โโโโ signal_session_consumed (series bool)
SMTBuffer
โโFields:
โโโโ session_smts (array)
โโโโ daily_smts (array)
โโโโ intra_smts (array)
โโโโ invalidated (array)
โโโโ delete_buffer (array)
โโโโ monitored_sessions (array)
โโโโ monitored_days (array)
โโโโ consumed_days (array)
โโโโ max_days (series int)
โโโโ best_bull_smt (SMT)
โโโโ best_bear_smt (SMT) Perpustakaan

MarketReactionLibrary "MarketReaction"
Modular library for sessions, Initial Balance, PSY ranges, VWAPs, alerts, and macro sentiment helpers.
getSessionConfig(source)
โโReturns session config by source name.
โโParameters:
โโโโ source (simple string) : Session source: Tokyo, New York, London, Jerusalem, EU B, US B.
โโReturns: SessionConfig.
sessionModule(session, timeZone, sessionText, sessionColor, sessionDuration, showVisuals, showLabels, showLines, showMiddleLine, showBg, bgTransp)
โโBuilds session high/low/middle lines, label, background fill and VWAP.
โโParameters:
โโโโ session (simple string) : Session string.
โโโโ timeZone (simple string) : IANA timezone.
โโโโ sessionText (simple string) : Label text.
โโโโ sessionColor (color) : Session color.
โโโโ sessionDuration (simple int) : Approximate session duration in ms.
โโโโ showVisuals (bool) : Show this session visuals.
โโโโ showLabels (bool) : Show labels.
โโโโ showLines (bool) : Show high/low lines.
โโโโ showMiddleLine (bool) : Show middle line.
โโโโ showBg (bool) : Show background fill.
โโโโ bgTransp (int) : Background transparency.
โโReturns: SessionResult.
initialBalanceModule(session, ibSession, timeZone, sessionLabel, showDLabels, showWLabels, showMLabels, showPrevD, showPrevW, showPrevM, dColor, wColor, mColor)
โโCalculates Daily, Weekly, Monthly Initial Balance and W/M IB VWAPs.
โโParameters:
โโโโ session (simple string) : Full session string.
โโโโ ibSession (simple string) : IB sub-session string.
โโโโ timeZone (simple string) : IANA timezone.
โโโโ sessionLabel (simple string) : Session label.
โโโโ showDLabels (bool) : Show D.IB labels.
โโโโ showWLabels (bool) : Show W.IB labels.
โโโโ showMLabels (bool) : Show M.IB labels.
โโโโ showPrevD (bool) : Calculate previous daily IB.
โโโโ showPrevW (bool) : Calculate previous weekly IB.
โโโโ showPrevM (bool) : Calculate previous monthly IB.
โโโโ dColor (color) : Daily IB label color.
โโโโ wColor (color) : Weekly IB label color.
โโโโ mColor (color) : Monthly IB label color.
โโReturns: IBResult.
psyRangeModule(session, timeZone, showLabels, showPrev, sessionColor)
โโCalculates PSY high/low, previous PSY levels, labels, and VWAP.
โโParameters:
โโโโ session (simple string) : Session string.
โโโโ timeZone (simple string) : Timezone.
โโโโ showLabels (bool) : Show PSY labels.
โโโโ showPrev (bool) : Show previous PSY levels.
โโโโ sessionColor (color) : PSY color.
โโReturns: PSYResult.
rangeSignal(highLevel, lowLevel, price)
โโReturns enter/exit signals for a range.
โโParameters:
โโโโ highLevel (float) : Range high.
โโโโ lowLevel (float) : Range low.
โโโโ price (float) : Price source.
โโReturns: RangeSignal.
tablePosition(pos)
โโConverts table position string to Pine position.
โโParameters:
โโโโ pos (simple string) : Position text.
โโReturns: Pine table position.
SessionConfig
โโSession configuration.
โโFields:
โโโโ session (series string) : Full session time.
โโโโ ib (series string) : Initial Balance sub-session time.
โโโโ tz (series string) : Session timezone.
โโโโ label (series string) : Session label.
โโโโ col (series color) : Session color.
โโโโ duration (series int) : Approximate session duration in milliseconds.
SessionResult
โโSession result.
โโFields:
โโโโ high (series float) : Session high.
โโโโ low (series float) : Session low.
โโโโ mid (series float) : Session middle.
โโโโ vwap (series float) : Session VWAP.
โโโโ inSession (series bool) : True if bar is inside session.
โโโโ firstBar (series bool) : True on first session bar.
โโโโ highLine (series line) : Session high line.
โโโโ lowLine (series line) : Session low line.
โโโโ midLine (series line) : Session middle line.
IBResult
โโInitial Balance result.
โโFields:
โโโโ dHigh (series float) : Daily IB high.
โโโโ dLow (series float) : Daily IB low.
โโโโ pdHigh (series float) : Previous daily IB high.
โโโโ pdLow (series float) : Previous daily IB low.
โโโโ wHigh (series float) : Weekly IB high.
โโโโ wLow (series float) : Weekly IB low.
โโโโ pwHigh (series float) : Previous weekly IB high.
โโโโ pwLow (series float) : Previous weekly IB low.
โโโโ mHigh (series float) : Monthly IB high.
โโโโ mLow (series float) : Monthly IB low.
โโโโ pmHigh (series float) : Previous monthly IB high.
โโโโ pmLow (series float) : Previous monthly IB low.
โโโโ wVwap (series float) : Weekly IB VWAP.
โโโโ mVwap (series float) : Monthly IB VWAP.
โโโโ inSession (series bool) : True if bar is inside selected full session.
โโโโ inIB (series bool) : True if bar is inside selected IB session.
โโโโ ibFirstBar (series bool) : True on first IB bar.
โโโโ sessionFirstBar (series bool) : True on first full-session bar.
PSYResult
โโPSY range result.
โโFields:
โโโโ high (series float) : Current PSY high.
โโโโ low (series float) : Current PSY low.
โโโโ pHigh (series float) : Previous PSY high.
โโโโ pLow (series float) : Previous PSY low.
โโโโ vwap (series float) : PSY VWAP.
โโโโ inSession (series bool) : True if bar is inside PSY range.
โโโโ firstBar (series bool) : True on first PSY bar.
RangeSignal
โโRange signal result.
โโFields:
โโโโ enter (series bool) : True when price enters range.
โโโโ exit (series bool) : True when price exits range.
โโโโ topDn (series bool) : Crossunder from above high.
โโโโ topUp (series bool) : Crossover above high.
โโโโ botUp (series bool) : Crossover from below low.
โโโโ botDn (series bool) : Crossunder below low. Perpustakaan
