PROTECTED SOURCE SCRIPT
Composite PR Signal (Trend↔Revert + ADX gate)

Core Components
1. Dynamic Inputs
Max/PR windows (maxLen, prWin) – define historical lookbacks for oscillators and percentile ranks.
Smoothing (smooth) – applies an EMA filter to stabilize composite scores.
Threshold (th) – governs entry sensitivity.
Holding period (hBars) – maximum bars allowed in a trade.
Execution options – allow shorting, fast approximations for PR and CCI.
2. Custom Utility Functions
The script implements optimized versions of common TA operations:
Rolling sums, delays, and moving averages (EMA, RMA, SMA).
Lazy rolling extrema (efficient highest/lowest lookups).
Stateful arrays for tracking oscillator values across bars.
Fast approximations for percentile ranks and indicators.
3. Indicators Used
The system calculates a broad set of oscillators, including:
Trend/Momentum: ROC, TRIX, TSI, MACD histogram, OBV ROC, AO, CMF, BOP, UO, ADX.
Reversion/Oscillators: RSI, Stochastic K/D, MFI, Williams %R, CCI, CMO.
Each is converted into a percentile rank (PR) to normalize values between 0–100.
4. Composite Scoring
Two composite signals are built:
Trend Score – averages normalized outputs of momentum indicators.
Reversion Score – averages normalized outputs of oscillators prone to mean reversion.
ADX Gate – when ADX PR is high, the strategy favors trend score; when low, it favors reversion score.
Final score is smoothed and compared against entry thresholds.
5. Trade Logic
Entry:
Long: When composite score crosses above +th.
Short: When composite score crosses below -th (if enabled).
Exit:
Opposite crossover signal.
Or trade duration exceeds hBars.
6. Risk/Execution Parameters
Initial capital: 100,000
Commission: 0.01% per trade
Fixed order size: 100 units
No pyramiding
Intended Use
This script is designed for:
Swing trading across multiple assets (equities, forex, crypto).
Adapting to market regimes — capturing breakouts during strong trends, but fading moves when markets are choppy.
1. Dynamic Inputs
Max/PR windows (maxLen, prWin) – define historical lookbacks for oscillators and percentile ranks.
Smoothing (smooth) – applies an EMA filter to stabilize composite scores.
Threshold (th) – governs entry sensitivity.
Holding period (hBars) – maximum bars allowed in a trade.
Execution options – allow shorting, fast approximations for PR and CCI.
2. Custom Utility Functions
The script implements optimized versions of common TA operations:
Rolling sums, delays, and moving averages (EMA, RMA, SMA).
Lazy rolling extrema (efficient highest/lowest lookups).
Stateful arrays for tracking oscillator values across bars.
Fast approximations for percentile ranks and indicators.
3. Indicators Used
The system calculates a broad set of oscillators, including:
Trend/Momentum: ROC, TRIX, TSI, MACD histogram, OBV ROC, AO, CMF, BOP, UO, ADX.
Reversion/Oscillators: RSI, Stochastic K/D, MFI, Williams %R, CCI, CMO.
Each is converted into a percentile rank (PR) to normalize values between 0–100.
4. Composite Scoring
Two composite signals are built:
Trend Score – averages normalized outputs of momentum indicators.
Reversion Score – averages normalized outputs of oscillators prone to mean reversion.
ADX Gate – when ADX PR is high, the strategy favors trend score; when low, it favors reversion score.
Final score is smoothed and compared against entry thresholds.
5. Trade Logic
Entry:
Long: When composite score crosses above +th.
Short: When composite score crosses below -th (if enabled).
Exit:
Opposite crossover signal.
Or trade duration exceeds hBars.
6. Risk/Execution Parameters
Initial capital: 100,000
Commission: 0.01% per trade
Fixed order size: 100 units
No pyramiding
Intended Use
This script is designed for:
Swing trading across multiple assets (equities, forex, crypto).
Adapting to market regimes — capturing breakouts during strong trends, but fading moves when markets are choppy.
보호된 스크립트입니다
이 스크립트는 비공개 소스로 게시됩니다. 하지만 제한 없이 자유롭게 사용할 수 있습니다 — 여기에서 자세히 알아보기.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
보호된 스크립트입니다
이 스크립트는 비공개 소스로 게시됩니다. 하지만 제한 없이 자유롭게 사용할 수 있습니다 — 여기에서 자세히 알아보기.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.