OPEN-SOURCE SCRIPT
已更新 Apex Matrix V4 Strategy: Martingale & Dynamic Exit

This script is published for educational and analytical purposes. It demonstrates a complex, multi-layered algorithmic trading system designed to identify liquidity sweeps and leverage traps in the cryptocurrency market.
█ WARNING — MARTINGALE RISK DISCLOSURE
This strategy explicitly utilizes a Martingale position-sizing system. If a trade moves against the entry (adverse excursion), the algorithm will aggressively double the allocated margin on the next valid signal to pull the average entry price closer to the current market price. Martingale systems carry extreme inherent risk and can lead to rapid and total liquidation of capital during sustained, unidirectional trends. Do not use this system with real funds without fully understanding the mathematical risk of ruin.
█ WHAT THIS SCRIPT DOES
This strategy executes mean-reversion trades by identifying areas where retail leverage is trapped, using a combination of price action (Swing Failure Patterns) and multi-exchange Open Interest aggregation.
█ HOW IT FINDS SETUPS (THE 4 PILLARS)
1 — Macro Flow (USDT.D Proxy): Evaluates Tether Dominance to ensure fiat is flowing into or out of the crypto market, providing macro trend alignment.
2 — Synthetic Leverage (Aggregated OI): Sums the Open Interest from Binance, Bybit, and OKX. It looks for "flushed" OI to confirm safe bottoms and "spiking" OI to identify overheated tops.
3 — Topological Sweeps (SFP): The trigger only arms when price pierces a 20-period high/low boundary and immediately closes back inside the range, trapping breakout traders.
4 — TDA Cluster Collapse: Requires a 2-standard-deviation volume anomaly or extreme candle body absorption (Effort vs. Result) to validate institutional presence.
█ HOW IT MANAGES RISK (ASYMMETRIC EXITS & RATCHETS)
• Logical Stop: Evaluates a 2% stop loss strictly on the candle close to avoid getting stopped out by manipulative, high-leverage exchange wicks.
• Catastrophe Stop: A hidden 4% wick-based hard stop to protect against flash crashes.
• Dual-Tier Ratchet: The millisecond price wicks to +1% profit, the stop is hard-locked at break-even. At +1.5%, the stop is pulled up to +1.5% and locked.
• 10% Max Take Profit: A hard limit order is placed at 10% for absolute profit capping.
• Dynamic Trailing: Closes early if price loses short-term momentum (crosses 5 EMA).
Some results as of releasing this indicator (5000USD portfolio $50 margin with 100x leverage simulated, 0.05% commision as default Binance taker fee):
Symbol 1m, 3m, 5m, 15m, 30m, 1h, Total
BTC, 152.96, 131.37, 161.78, 455.3, 26.36, 295.6, 1223.37
BTCP, 412.33, 39.28, 34.07,, 398.53, 147.33, 280.25, 1311.79
ETH, 282.95, -101.47, -126.71, 372.93, 682.07, 888.3, 1998.07
ETHP 467.5, 101.64, -233.13, 350.69, -1098.64, 792.2, 380.26
XRP, 241.35, 214.84, 378.16, -232.94, 800.46, 2113.84, 3515.71
XRPP , 260.39, 269.6, 346.76, -451.94, 954.07, 2164.21, 3543.09
SOL , 66.2, -111.94, 142.32, 204.16, 435.25, 658.54, 1394.53
SOLP , 228.78, 580.46, -104.32, 384.45, 805.72, 508.05, 2403.14
Total , 743.46, 132.8, 555.55, 799.45, 1944.14, 3956.28, 8131.68
TotalP 1369, 990.98, 43.38, 681.73, 808.48, 3744.71, 7638.28
█ WARNING — MARTINGALE RISK DISCLOSURE
This strategy explicitly utilizes a Martingale position-sizing system. If a trade moves against the entry (adverse excursion), the algorithm will aggressively double the allocated margin on the next valid signal to pull the average entry price closer to the current market price. Martingale systems carry extreme inherent risk and can lead to rapid and total liquidation of capital during sustained, unidirectional trends. Do not use this system with real funds without fully understanding the mathematical risk of ruin.
█ WHAT THIS SCRIPT DOES
This strategy executes mean-reversion trades by identifying areas where retail leverage is trapped, using a combination of price action (Swing Failure Patterns) and multi-exchange Open Interest aggregation.
█ HOW IT FINDS SETUPS (THE 4 PILLARS)
1 — Macro Flow (USDT.D Proxy): Evaluates Tether Dominance to ensure fiat is flowing into or out of the crypto market, providing macro trend alignment.
2 — Synthetic Leverage (Aggregated OI): Sums the Open Interest from Binance, Bybit, and OKX. It looks for "flushed" OI to confirm safe bottoms and "spiking" OI to identify overheated tops.
3 — Topological Sweeps (SFP): The trigger only arms when price pierces a 20-period high/low boundary and immediately closes back inside the range, trapping breakout traders.
4 — TDA Cluster Collapse: Requires a 2-standard-deviation volume anomaly or extreme candle body absorption (Effort vs. Result) to validate institutional presence.
█ HOW IT MANAGES RISK (ASYMMETRIC EXITS & RATCHETS)
• Logical Stop: Evaluates a 2% stop loss strictly on the candle close to avoid getting stopped out by manipulative, high-leverage exchange wicks.
• Catastrophe Stop: A hidden 4% wick-based hard stop to protect against flash crashes.
• Dual-Tier Ratchet: The millisecond price wicks to +1% profit, the stop is hard-locked at break-even. At +1.5%, the stop is pulled up to +1.5% and locked.
• 10% Max Take Profit: A hard limit order is placed at 10% for absolute profit capping.
• Dynamic Trailing: Closes early if price loses short-term momentum (crosses 5 EMA).
Some results as of releasing this indicator (5000USD portfolio $50 margin with 100x leverage simulated, 0.05% commision as default Binance taker fee):
Symbol 1m, 3m, 5m, 15m, 30m, 1h, Total
BTC, 152.96, 131.37, 161.78, 455.3, 26.36, 295.6, 1223.37
BTCP, 412.33, 39.28, 34.07,, 398.53, 147.33, 280.25, 1311.79
ETH, 282.95, -101.47, -126.71, 372.93, 682.07, 888.3, 1998.07
ETHP 467.5, 101.64, -233.13, 350.69, -1098.64, 792.2, 380.26
XRP, 241.35, 214.84, 378.16, -232.94, 800.46, 2113.84, 3515.71
XRPP , 260.39, 269.6, 346.76, -451.94, 954.07, 2164.21, 3543.09
SOL , 66.2, -111.94, 142.32, 204.16, 435.25, 658.54, 1394.53
SOLP , 228.78, 580.46, -104.32, 384.45, 805.72, 508.05, 2403.14
Total , 743.46, 132.8, 555.55, 799.45, 1944.14, 3956.28, 8131.68
TotalP 1369, 990.98, 43.38, 681.73, 808.48, 3744.71, 7638.28
發行說明
Added an HMM regime detector. It can potentially drastically reduce drawdowns while keeping similar profits, usually on higher timeframes. It opens the door to higher leverage strategies, the risk is still greater, it does not guarantee you success on higher leverage than without it or at all.開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。