OPEN-SOURCE SCRIPT

Market Mode Risk Indicator

65
Market Mode Risk Indicator v1.1
This custom indicator helps traders gauge market risk sentiment by monitoring Exponential Moving Average (EMA) or Simple Moving Average (SMA) crossovers on key indices like BIST 100 (for Turkish markets), NASDAQ Composite (tech-focused US), or Dow Jones Industrial Average (industrial US). It dynamically categorizes the market into three actionable modes based on the index's position relative to layered MAs, providing a quick visual snapshot without cluttering your chart.
Risk Modes Explained:

RISK OFF (Red): Index closes below the Long MA (default 50 periods) – signals bearish caution; time to tighten stops or reduce exposure.
RISK TEST (Orange): Index above Medium MA1 (21 periods) and Extra Long MA (55 periods), but below Short MA (10 periods) and above Long MA – a transitional "test" phase; watch for confirmation before entering.
RISK ON (Green): Index above all MAs (Short, Medium, Long, Extra Long) – bullish green light; favorable for longs or momentum plays.

How It Works:
The core logic uses boolean checks on the index's close price against user-defined MA lengths. For example:

It pulls live data from your selected index via request.security.
Computes MAs with ternary operators for EMA (ta.ema) or SMA (ta.sma) based on your choice.
Mode detection relies on AND/OR conditions (e.g., aboveShort and aboveMed1 and aboveLong and aboveExtraLong for RISK ON) to filter noise and focus on meaningful shifts.
No lookahead bias – all calculations are historical and real-time compatible. Defaults (10/21/50/55) are inspired by common Fibonacci-inspired periods for balanced sensitivity.

Alerts fire only on mode transitions (e.g., from RISK OFF to ON) to prevent spam, using alertcondition with dynamic messages including price and ticker.
Customization Options:

Index & MA Settings: Switch EMA/SMA; tweak lengths (min 1 period) for your timeframe (e.g., shorter for intraday).
Display: Position the table (top/bottom, left/right); toggle MA values on/off.
Looks: Background/border/text colors, transparency (0-100%) for theme matching.

Built in Pine Script v5 for efficiency – lightweight, no repaints.
Usage Tips:

Add to any stock chart (e.g., GARAN for BIST analysis).
Select your index in settings; refresh chart if switching MA type.
Use on daily/4H timeframes for swing trading; alerts via email/SMS for hands-free monitoring.
Pro Tip: Combine with volume or RSI for confirmation – RISK ON + rising volume = stronger buy signal.

免責聲明

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