Vector Logic: Macro Regime SwingVector Logic: Macro Regime Swing 🦅
Most standard moving average strategies fail because they cannot tell the difference between a true trending market and a sideways "chop zone" (accumulation/distribution). They constantly fire false 'BUY' and 'SELL' signals while the asset is just moving sideways, leading to a slow bleed of your capital.
The Vector Logic: Macro Regime Swing indicator was built to solve exactly that. Instead of just looking for trends, this script mathematically detects when a stock has fallen asleep, throws up a visual "Trap," and sits safely on the sidelines until a real breakout happens.
⚙️ How the Engine Works
This indicator combines four engines/logics to confirm a trade:
1. The Macro Trap (The Purple Lines) 🟪
The script constantly monitors the last 60 days of price action. If the asset goes just 7 days without making a new 60-day high or low, the indicator declares the stock is "chopping."
• It instantly draws a faint purple ceiling and floor on your chart.
• While the price is trapped inside this purple chop zone, all trades are strictly blocked. You sit safely on the sidelines.
2. The Trend Engine (The Blue & Orange Lines) 🌊
For a trend to be valid, the script requires structural alignment. We use a classic, robust Moving Average crossover:
• Fast Trend: 20-period EMA (Cyan)
• Slow Trend: 50-period EMA (Orange)
• The price must be aggressively crossing the 20 EMA in the direction of the trend to trigger an entry.
3. The Volume Consensus 📊
A breakout without volume is a trap. The script monitors On-Balance-Volume (OBV) in the background. A trade will only fire if institutional volume is actively pushing the price in your direction.
4. The Momentum Exit (The Yellow Dotted Line) 🟡
Getting into a trade is only half the battle; keeping your profits is the other.
Instead of waiting for the price to crash all the way back down to the 20 or 50 EMA, this script uses a rapid 10-period EMA (the dotted yellow line) as a tight trailing stop. The moment a daily candle closes on the wrong side of this yellow line, the script ruthlessly exits the trade to lock in your momentum profits.
⏱️ Adapting for Smaller Timeframes
By default, the VL Macro Regime is tuned for Daily (1D) swing trading. However, the engine is fully dynamic. When you drop down to intraday timeframes (like 1H, 15m, or 5m), keep in mind that "Days" in the settings menu translates directly to "Candles" or "Bars". If you want to trap a true macro-level chop zone on a 15-minute chart, you should increase your Historical Range Lookback (e.g., 100 to 200 bars) to capture the overarching structure of the week. For highly aggressive day trading, you can also tighten the Trend MAs (e.g., 9 and 21) to catch rapid intraday momentum breakouts before the volume fades.
💡 How to Read the Chart
• BUY / SELL Labels: A clean, confirmed breakout. The trend is aligned, volume is backing it up, and the stock has escaped the purple Macro Trap.
• EXIT Circles: The tiny grey circles tell you exactly when the price closed across the yellow 10 EMA trailing stop. Time to take your profits and step away.
• TP Flags: Subtle green flags suggest a standard 5% partial Take-Profit zone.
• The Dashboard HUD: Located in the top right, this panel gives you a real-time pulse check on the current trade status, volatility state, and volume trend.
🛠️ Built-In Failsafes
• Zero Repainting: All signals are strictly hardcoded to the candle close (barstate.isconfirmed). What you see on a closed daily candle is permanently locked in history. No flickering, no vanishing signals.
• Glitch Protection: Automatically untethers and resets itself if it encounters broken historical data or extreme anomalies (like leveraged ETF reverse splits).
Disclaimer: This script is for educational and informational purposes only. It does not constitute financial advice. Always backtest strategies and manage your own risk.
Pine Script® 인디케이터






















