Market Risk Regime Dashboard (SPX/VIX)Market Risk Regime Dashboard (SPX–VIX)
Market Risk Regime Dashboard (SPX–VIX) is a context and confirmation tool designed to classify market conditions as Risk-On, Risk-Off, or Neutral by analyzing the real-time relationship between the S&P 500 Index (SPX) and the CBOE Volatility Index (VIX).
Rather than predicting price direction, this script focuses on identifying market environment and participation conditions that often influence trade quality, position sizing, and strategy selection.
Core Concept: SPX vs VIX Risk Regimes
The indicator operates on a well-documented market relationship:
SPX reflects equity risk appetite and directional participation
VIX reflects implied volatility and risk aversion
The script classifies conditions as:
Risk-On → SPX bullish and VIX falling
Risk-Off → SPX bearish and VIX rising
Neutral → Any mixed or non-aligned condition
This alignment is visualized using:
Background color on the chart
A compact dashboard table
Optional alerts
Trend Strength via Normalized EMA Distance (n-Value)
To quantify trend strength, the script computes a normalized trend metric (“n-value”) for SPX:
A fast EMA and slow EMA are calculated on SPX
The absolute distance between the EMAs is measured
That distance is normalized by an ATR-based volatility measure
The result is a dimensionless value that expresses trend strength relative to volatility, allowing comparisons across timeframes.
Higher n-values indicate stronger directional conditions, while lower values suggest compression or range behavior.
Dashboard Display
A movable on-chart table summarizes:
SPX directional bias (Bullish / Bearish / Neutral)
VIX behavior (Rising / Falling)
SPX n-value trend strength
This allows traders to quickly assess market context without switching symbols or charts.
Strong Candle Detection (SPX)
The script identifies strong directional candles on SPX using objective criteria:
Candle body must represent a minimum percentage of total range
Close must occur near the extreme (high for bullish, low for bearish)
Direction must align with candle body
When detected:
A triangle marker is plotted
The chart bar is optionally colored
Additional alerts can trigger when strong candles align with Risk-On or Risk-Off regimes
These signals are intended to highlight initiative participation, not standalone entries.
Visual & Alert Features
Background color reflects current risk regime:
Green = Risk-On
Red = Risk-Off
Gray = Neutral
Alerts available for:
Risk-On alignment
Risk-Off alignment
Neutral conditions
Strong candles aligned with risk regime
Elevated normalized trend strength (n-value range)
Alerts can be used for situational awareness rather than execution triggers.
How Traders Typically Use This Script
Filter trades based on broader market risk context
Adjust aggressiveness or size during Risk-On vs Risk-Off regimes
Confirm directional conviction when price action aligns with volatility behavior
Avoid forcing trades during neutral or conflicting environments
This script is not a trading system and does not provide entries or exits. It is a contextual decision-support tool designed to improve alignment between price action and market risk conditions.
Alignment
Power Hour Money StrategyDescription of the Pine Script Code: "Power Hour Money Strategy"
This Pine Script strategy, "Power Hour Money Strategy," is designed to trade based on the alignment of multiple time frames (month, week, day, and hour). The strategy aims to enter long or short positions depending on whether all selected time frames are in sync (all green for long positions, all red for short positions). Additionally, the script includes configurations for trading during specific sessions and automatically closing positions at the end of the trading day.
Core Features:
1. Time Frame Sync Check:
- The strategy evaluates whether the current price is higher than the opening price for the month, week, day, and hour to determine if each time frame is "green" (bullish) or "red" (bearish).
2. Session Control:
- The user can select between different trading sessions:
- "NY Session 9:30-11:30"
- "Extended NY Session 8-4"
- "All Sessions"
- Trades are only executed if the current time falls within the selected session.
3. Trailing Stop Mechanism:
- The strategy includes an optional trailing stop mechanism for both long and short positions.
- The trailing stop is configured with a percentage loss from the current price to protect gains.
4. End-of-Day Position Management:
- An option is provided to automatically close all positions at the end of the trading day (5:45 PM Eastern Time).
Detailed Code Breakdown:
1. Input Settings:
- **Session Selection**: Allows the user to choose the trading session.
- **End-of-Day Close**: Option to automatically close positions at the end of the day.
- **Trailing Stop Loss**: Enables or disables the trailing stop loss feature and sets the percentage for long and short positions.
2. Time Frame Calculations:
- The script uses `request.security` to get the opening prices for higher time frames (monthly, weekly, daily, and hourly).
- It compares the current close price to these opening prices to determine if each time frame is green or red.
3. Session Time Definitions:
- Defines the start and end times for the NY session (9:30-11:30 AM) and the extended session (8:00 AM - 4:00 PM).
4. Trade Execution:
- The strategy checks if all selected time frames are in sync and if the current time falls within the trading session.
- If all conditions are met, it enters a long or short position.
5. Trailing Stop Loss Implementation:
- Adjusts the stop price based on the trailing percentage and the current position's size.
- Automatically exits positions if the trailing stop condition is met.
6. End-of-Day Close Implementation:
- Uses a timestamp to check if the current time is 5:45 PM Eastern Time.
- Closes all positions if the end-of-day condition is met.
7. Plotting and Logging:
- Plots indicators to visualize the green/red status of each time frame.
- Logs information about the status of each time frame for debugging and analysis.
Example Usage:
Entering a Long Position: If the month, week, day, and hour are all green and the current time is within the selected session, a long position is entered.
Entering a Short Position: If the month, week, day, and hour are all red and the current time is within the selected session, a short position is entered.
Trailing Stop: Protects gains by exiting the position if the price moves against the set trailing stop percentage.
End-of-Day Close: Automatically closes all open positions at 5:45 PM Eastern Time if enabled.
This strategy is particularly useful for traders who want to ensure that multiple time frames are in alignment before entering a trade and who wish to manage positions effectively throughout the trading day with specific session controls and trailing stops.

