已更新

CryptonianFibTrade

275
Library "CryptonianFibTrade"
[Cryptonian] Fibonacci Trade Engine v1. Confirmed-bar entries, frozen geometry, unambiguous closed-bar lifecycle.
Signals are reference-price decisions, NOT broker fills. Never infer intrabar order.

createPosition(newId, sourceWatchId, dir, signalClose, thesisStop, sourceObjective, confirmedBar, confirmedTime, requiredRR, tp1RiskMultiple, tick)
  Create only on the ACTUAL first completed confirmation candle of a still-active source watch. The host enforces this.
  Parameters:
    newId (int): Monotonic trade identity.
    sourceWatchId (int): Source watch identity.
    dir (int): 1 long, -1 short.
    signalClose (float): Completed host candle CLOSE used as reference entry.
    thesisStop (float): Watch's immutable original invalidation.
    sourceObjective (float): Watch's immutable original objective.
    confirmedBar (int): Signal bar index.
    confirmedTime (int): Signal candle close timestamp.
    requiredRR (float): Minimum reward/risk at close.
    tp1RiskMultiple (float): TP1 distance as a multiple of original risk, strictly less than RR.
    tick (float): Symbol minimum tick.
  Returns: A valid immutable-by-contract trade plan or invalid instance.

advance(trade, confirmedHigh, confirmedLow, confirmedBar)
  One-bar deterministic transition from COMPLETED candle OHLC, only AFTER signal candle.
TP1 arms BE for later candles, not retroactively inside its touching bar.
If competing endpoints are inside the same completed candle, event is AMBIGUOUS.
  Parameters:
    trade (Position): Existing reference trade.
    confirmedHigh (float): Closed bar's high.
    confirmedLow (float): Closed bar's low.
    confirmedBar (int): Closed bar index.
  Returns: Same reference with frozen entry/original SL/targets and one-way state transition.

isOpen(trade)
  Whether the trade remains open in the indicator's reference lifecycle.
  Parameters:
    trade (Position)

isClosed(trade)
  Whether a terminal outcome was permanently recorded.
  Parameters:
    trade (Position)

statusText(trade)
  Compact status text, never a win probability.
  Parameters:
    trade (Position)

Position
  One independently snapshotted reference trade. No UDT alias to forecast/watch.
  Fields:
    valid (series bool): Whether this entry passed all constraints at the closed signal bar.
    id (series int): Unique in this chart calculation.
    watchId (series int): Source forecast ID; never reuse to open another trade.
    direction (series int): 1 long, -1 short.
    signalBar (series int): Actual confirmation / signal bar; never an earlier swing pivot bar.
    signalTime (series int): Signal candle time_close.
    entry (series float): Frozen SIGNAL CLOSE reference price (not a broker fill).
    originalStop (series float): Frozen thesis invalidation used as initial reference stop.
    target1 (series float): Frozen 1R or configured R first target.
    target2 (series float): Frozen source forecast objective.
    managedStop (series float): Dynamic stop; after TP1, set to entry for NEXT bar onward.
    rewardRisk (series float): R:R to target2 at publication time.
    status (series TradeStatus): One-way lifecycle state.
    tp1Bar (series int): First confirmed bar touching target1.
    exitBar (series int): Confirmed terminal event bar.
    exitPrice (series float): Reference exit level, na when order within candle is unknowable.
發行說明
v2

Added:
armStructuralProfitLock(trade, pivotPrice, pivotBar, confirmationBar, lastClose, minLockedR, onlyAfterTP1, tick)
  Tighten an existing open reference trade using a CONFIRMED post-entry
structural pivot. Must be called AFTER advance() on the same completed bar;
the new stop is evaluated on the NEXT bar only. Never changes original SL,
entry, TP1 or TP2; never loosens managedStop.
  Parameters:
    trade (Position): Existing position, not a forecast.
    pivotPrice (float): Fully confirmed local swing (low for long, high for short).
    pivotBar (int): Actual pivot bar (not its later confirmation bar).
    confirmationBar (int): Bar index that first knew this pivot was confirmed.
    lastClose (float): Completed execution bar close, used to reject crossed stops.
    minLockedR (float): Minimum locked PROFIT in original risk multiples.
    onlyAfterTP1 (bool): If true, requires trade to have reached TP1.
    tick (float): Price minimum tick for strict comparisons.
  Returns: Same trade with a monotonically tightened managed stop if eligible.

Updated:
Position
  One independently snapshotted reference trade. No UDT alias to forecast/watch.
  Fields:
    valid (series bool): Whether this entry passed all constraints at the closed signal bar.
    id (series int): Unique in this chart calculation.
    watchId (series int): Source forecast ID; never reuse to open another trade.
    direction (series int): 1 long, -1 short.
    signalBar (series int): Actual confirmation / signal bar; never an earlier swing pivot bar.
    signalTime (series int): Signal candle time_close.
    entry (series float): Frozen SIGNAL CLOSE reference price (not a broker fill).
    originalStop (series float): Frozen thesis invalidation used as initial reference stop.
    target1 (series float): Frozen 1R or configured R first target.
    target2 (series float): Frozen source forecast objective.
    managedStop (series float): Dynamic stop; after TP1, set to entry for NEXT bar onward.
    rewardRisk (series float): R:R to target2 at publication time.
    status (series TradeStatus): One-way lifecycle state.
    tp1Bar (series int): First confirmed bar touching target1.
    exitBar (series int): Confirmed terminal event bar.
    exitPrice (series float): Reference exit level, na when order within candle is unknowable.
    profitLockPrice (series float): Last confirmed post-entry structural lock price, na when none.
    profitLockSourceBar (series int): Pivot bar that establishes the lock; must be after entry.
    profitLockConfirmedBar (series int): Bar when structural pivot became confirmed.
    profitLockRevisions (series int): Number of one-way tightening events for this trade.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。