PROTECTED SOURCE SCRIPT

Universal Regime Alpha Thermocline Strategy

80
Currents settings adapted for BTCUSD Daily timeframe



This description is written to comply with TradingView House Rules and Script Publishing Rules. It is self contained, in English first, free of advertising, and explains originality, method, use, defaults, and limitations. No external links are included. Nothing here is investment advice.


0. Publication mode and rationale
This script is published as Protected. Anyone can add and test it from the Public Library, yet the source code is not visible.

Why Protected
  • The engine combines three independent lenses into one regime score and then uses an adaptive centering layer and a thermo risk unit that share a common AAR measure. The exact mapping and interactions are the result of original research and extensive validation. Keeping the implementation protected preserves that work and avoids low effort clones that would fragment feedback and confuse users.
  • Protection supports a single maintained build for users. It reduces accidental misuse of internal functions outside their intended context which might lead to misleading results.


1. What the strategy does in one paragraph
Universal Regime Alpha Thermocline builds a single number between zero and one that answers a practical question for any market and timeframe. How aligned is current price action with a persistent directional regime right now. To answer this the script fuses three views of the tape. Directional entropy of up versus down closes to measure unanimity.
Convexity drift that rewards true geometric compounding and penalizes drag that comes from chop where arithmetic pace is high but growth is poor.
Tail imbalance that counts decisive bursts in one direction relative to typical bar amplitude. The three channels are blended, optionally confirmed by a higher timeframe, and then adaptively centered to remove local bias. Entries fire when the score clears an entry gate. Exits occur when the score mean reverts below an exit gate or when thermo stops remove risk. Position size can scale with the certainty of the signal.

2. Why it is original and useful
  • It mixes orthogonal evidence instead of leaning on a single family of tools. Many regime filters depend on moving averages or volatility compression. Here we add an information view from entropy, a growth view from geometric drift, and a structural view from tail imbalance.
  • The drift channel separates growth from speed. Arithmetic pace can look strong in whipsaw, yet geometric growth stays weak. The engine measures both and subtracts drag so that only sequences with compounding quality rise.
  • Tail counting is anchored to AAR which is the average absolute return of bars in the window. This makes the threshold self scaling and portable across symbols and timeframes without hand tuned constants.
  • Adaptive centering prevents the score from living above or below neutral for long stretches on assets with strong skew. It recovers neutrality while still allowing persistent regimes to dominate once evidence accumulates.
  • The same AAR unit used in the signal also sets stop distance and trail distance. Signal and risk speak the same language which makes the method portable and easier to reason about.


3. Plain language overview of the math
  1. Log returns. The base series is r equal to the natural log of close divided by the previous close. Log return allows clean aggregation and makes growth comparisons natural.
  2. Directional entropy. Inside the lookback we compute the proportion p of bars where r is positive. Binary entropy of p is high when the mix of up and down closes is balanced and low when one direction dominates. Intensity is one minus entropy. Directional sign is two times p minus one. The trend channel is zero point five plus one half times sign times intensity. It lives between zero and one and grows stronger as unanimity increases.
  3. Convexity drift with drag. Arithmetic mean of r measures pace. Geometric mean of the price ratio over the window measures compounding. Drag is the positive part of arithmetic minus geometric. Drift raw equals geometric minus drag multiplier times drag. We then map drift through an arctangent normalizer scaled by AAR and a nonlinearity parameter so the result is stable and remains between zero and one.
  4. Tail imbalance. AAR equals the average of the absolute value of r in the window. We count up tails where r is greater than aar_mult times AAR and down tails where r is less than minus aar_mult times AAR. The imbalance is their difference over their total, mapped to zero to one. This detects directional impulse flow.
  5. Fusion and centering. A weighted average of the three channels yields the raw score. If a higher timeframe is requested, the same function is executed on that timeframe with lookahead off and blended with a weight. Finally we subtract a fraction of the rolling mean of the score to recover neutrality. The result is clipped to the zero to one band.


4. Entries, exits, and position sizing
  • Enter long when score is strictly greater than the entry gate. Enter short when score is strictly less than one minus the entry gate unless direction is restricted in inputs.
  • Exit a long when score falls below the exit gate. Exit a short when score rises above one minus the exit gate.
  • Thermo stops are expressed in AAR units. A long uses the maximum of an initial stop sized by the entry price and AAR and a trail stop that references the running high since entry with a separate multiple. Shorts mirror this with the running low. If the trail is disabled the initial stop is active.
  • Cooldown is a simple bar counter that begins when the position returns to flat. It prevents immediate re entry in churn.
  • Dynamic position size is optional. When enabled the order percent of equity scales between a floor and a cap as the score rises above the gate for longs or below the symmetric gate for shorts.


5. Inputs quick guide with recommended ranges
Every input has a tooltip in the script. The same guidance appears here for fast reading.

  • Core window. Shared lookback for entropy, drift, and tails. Start near 80 on daily charts. Try 60 to 120 on intraday and 80 to 200 for swing.
  • Entry threshold. Typical range 0.55 to 0.65 for trend following. Faster entries 0.50 to 0.55.
  • Exit threshold. Typical range 0.35 to 0.50. Lower holds longer yet gives back more.
  • Weight directional entropy. Starting value 0.40. Raise on markets with clean persistence.
  • Weight convexity drift. Starting value 0.40. Raise when compounding quality is critical.
  • Weight tail imbalance. Starting value 0.20. Raise on breakout prone markets.
  • Tail threshold vs AAR. Typical range 1.0 to 1.5 to count decisive bursts.
  • Drag penalty. Typical range 0.25 to 0.75. Higher punishes chop more.
  • Nonlinearity scale. Typical range 0.8 to 2.0. Larger compresses extremes.
  • AAR floor in percent. Typical range 0.0005 to 0.002 for liquid instruments. This stabilizes the math during quiet regimes.
  • Adaptive centering. Keep on for most symbols. Center strength 0.40 to 0.70.
  • Confirm timeframe optional. Leave empty to disable. If used, try a multiple between three and five of the chart timeframe with a blend weight near 0.20.
  • Dynamic position size. Enable if you want size to reflect certainty. Floor and cap define the percent of equity band. A practical band for many accounts is 0.5 to 2.
  • Cooldown bars after exit. Start at 3 on daily or slightly higher on shorter charts.
  • Thermo stop multiple. Start between 1.5 and 3.0 on daily. Adjust to your tolerance and symbol behavior.
  • Thermo trailing stop and Trail multiple. Trail on locks gains earlier. A trail multiple near 1.0 to 2.0 is common. You can keep trail off and let the exit gate handle exits.
  • Background heat opacity. Cosmetic. Set to taste. Zero disables it.


6. Properties used on the published chart
The example publication uses BTCUSD on the daily timeframe. The following Properties and inputs are used so everyone can reproduce the same results.

  • Initial capital 100000
  • Base currency USD
  • Order size 2 percent of equity coming from our risk management inputs.
  • Pyramiding 0
  • Commission 0.05 percent
  • Slippage 10 ticks in the publication for clarity. Users should introduce slippage in their own research.
  • Recalculate after order is filled off. On every tick off.
  • Using bar magnifier on. On bar close on.


Risk inputs on the published chart. Dynamic position size on. Size floor percent 2. Size cap percent 2. Cooldown bars after exit 3. Thermo stop multiple 2.5. Thermo trailing stop off. Trail multiple 1.

7. Visual elements and alerts
The score is painted as a subtle dot rail near the bottom. A background heat map runs from red to green to convey regime strength at a glance. A compact HUD at the top right shows current score, the three component channels, the active AAR, and the remaining cooldown. Four alerts are included. Long Setup and Short Setup on entry gates. Exit Long by Score and Exit Short by Score on exit gates. You can disable trading and use alerts only if you want the score as a risk switch inside a discretionary plan.

8. How to reproduce the example
  1. Open a BTCUSD daily chart with regular candles.
  2. Add the strategy and load the defaults that match the values above.
  3. Set Properties as listed in section 6.(they are set by default) Confirm that bar magnifier is on and process on bar close is on.
  4. Run the Strategy Tester. Confirm that the trade count is reasonable for the sample. If the count is too low, slightly lower the entry threshold or extend history. If the count is excessively high, raise the threshold or add a small cooldown.


9. Practical tuning recipes
  • Trend following focus. Raise the entry threshold toward 0.60. Raise the trend weight to 0.50 and reduce tail weight to 0.15. Keep drift near 0.35 to retain the growth filter. Consider leaving the trail off and let the exit threshold manage positions.
  • Breakout focus. Keep entry near 0.55. Raise tail weight to 0.35. Keep aar_mult near 1.3 so only decisive bursts count. A modest cooldown near 5 can reduce immediate false flips after the first burst bar.
  • Chop defense. Raise drag multiplier to 0.70. Raise exit threshold toward 0.48 to recycle capital earlier. Consider a higher cooldown, for example 8 to 12 on intraday.
  • Higher timeframe blend. On a daily chart try a weekly confirm with a blend near 0.20. On a five minute chart try a fifteen minute confirm. This moderates transitions.
  • Sizing discipline. If you want constant position size, set floor equal to cap. If you want certainty scaling, set a band like 0.5 to 2 and monitor drawdown behavior before widening it.


10. Strengths and limitations
Strengths
  • Self scaling unit through AAR makes the tool portable across markets and timeframes.
  • Blends evidence that target different failure modes. Unanimity, growth quality, and impulse flow rarely agree by chance which raises confidence when they align.
  • Adaptive centering reduces structural bias at the score level which helps during regime flips.


Limitations
  • In very quiet regimes AAR becomes small even with a floor. If your symbol is thin or gap prone, raise the floor a little to keep stops and drift mapping stable.
  • Adaptive centering can delay early breakout acceptance. If you miss starts, lower center strength or temporarily disable centering while you evaluate.
  • Tail counting uses a fixed multiple of AAR. If a market alternates between very calm and very violent weeks, a single aar_mult may not capture both extremes. Sweep this parameter in research.
  • The engine reacts to realized structure. It does not anticipate scheduled news or liquidity shocks. Use event awareness if you trade around releases.


11. Realism and responsible publication

  • No promises or projections of performance are made. Past results never guarantee future outcomes.
  • Commission is set to 0.05 percent per round which is realistic for many crypto venues. Adjust to your own broker or exchange.
  • Slippage is set at 10 in the publication . Introduce slippage in your own tests or use a percent model.
  • Position size should respect sustainable risk envelopes. Risking more than five to ten percent per trade is rarely viable. The example uses a fixed two percent position size.
  • Security calls use lookahead off. Standard candles only. Non standard chart types like Heikin Ashi or Renko are not supported for strategies that submit orders.


12. Suggested research workflow
  1. Begin with the balanced defaults. Confirm that the trade count is sensible for your timeframe and symbol. As a rough guide, aim for at least one hundred trades across a wide sample for statistical comfort. If your timeframe cannot produce that count, complement with multiple symbols or run longer history.
  2. Sweep entry and exit thresholds on a small grid and observe stability. Stability across windows matters more than the single best value.
  3. Try one higher timeframe blend with a modest weight. Large weights can drown the signal.
  4. Vary aar_mult and drag_mult together. This tunes the aggression of breakouts versus defense in chop.
  5. Evaluate whether dynamic size improves risk adjusted results for your style. If not, set floor equal to cap for constancy.
  6. Walk forward through disjoint segments and inspect results by regime. Bootstrapping or segmented evaluation can reveal sensitivity to specific periods.


13. How to read the HUD and heat map
The HUD presents a compact view. Score is the current fused value. Trend is the directional entropy channel. Drift is the compounding quality channel. Tail is the burst flow channel. AAR is the current unit that scales stops and the drift map. CD is the cooldown counter. The background heat is a visual aid only. It can be disabled in inputs. Green zones near the upper band show alignment among the channels. Muted colors near the mid band show uncertainty.

14. Frequently asked questions
  • Can I use this as a pure indicator. Yes. Disable entries by restricting direction to one side you will not trade and use the alerts as a regime switch.
  • Will it work on intraday charts. Yes. The AAR unit scales with bar size. You will likely reduce the core window and increase cooldown slightly.
  • Should I enable the adaptive trail. If you wish to lock gains sooner and accept more exits, enable it. If you prefer to let the exit gate do the heavy lifting, keep it off.
  • Why do I sometimes see a green background without a position. Heat expresses the score. A position also depends on threshold comparisons, direction mode, and cooldown.
  • Why is Order size set to one hundred percent if dynamic size is on. The script passes an explicit quantity percent on each entry. That explicit quantity overrides the property. The property is kept at one hundred percent to avoid confusion when users later disable dynamic sizing.
  • Can I combine this with other tools on my chart. You can, yet for publication the chart is kept clean so users and moderators can see the output clearly. In your private workspace feel free to add other context.



15. Concepts glossary
  • AAR. Average absolute return across the lookback. Serves as a unit for tails, drift scaling, and stops.
  • Directional entropy. A measure of uncertainty of up versus down closes. Low entropy paired with a directional sign signals unanimity.
  • Geometric mean growth. Rate that preserves the effect of compounding over many bars.
  • Drag. The positive difference between arithmetic pace and geometric growth. Larger drag often signals churn that looks active but fails to compound.
  • Thermo stops. Stops expressed in the same AAR unit as the signal. They adapt with volatility and keep risk and signal on a common scale.
  • Adaptive centering. A bias correction that recenters the fused score around neutral so the meter does not drift due to persistent skew.


16. Educational notice and risk statement

Markets involve risk. This publication is for education and research. It does not provide financial advice and it is not a recommendation to buy or sell any instrument. Use realistic costs. Validate ideas with out of sample testing and with conservative position sizing. Past performance never guarantees future results.


17. Final notes for readers and moderators
The goal of this strategy is clarity and portability. Clarity comes from a single score that reflects three independent features of the tape. Portability comes from self scaling units that respect structure across assets and timeframes. The publication keeps the chart clean, explains the math plainly, lists defaults and Properties used, and includes warnings where care is required. The code is protected so the implementation remains consistent for the community while the description remains complete enough for users to understand its purpose and for moderators to evaluate originality and usefulness. If you explore variants, keep them self contained, explain exactly what they contribute, publish in English first, and treat others with respect in the comments.

Load the strategy on BTCUSD daily with the defaults listed above and study how the score transitions across regimes. Then adjust one lever at a time. Observe how the trend channel, the drift channel, and the tail channel interact during starts, pauses, and reversals. Use the alerts as a risk switch inside your own process or let the built in entries and exits run if you prefer an automated study. The intent is not to promise outcomes. The intent is to give you a robust meter for regime strength that travels well across markets and helps you structure decisions with more confidence.

Thank you for your time to read all of this

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。