OPEN-SOURCE SCRIPT
SPY Market Cycle Bias (Risk-On vs Risk-Off)

This indicator identifies whether the overall market environment is in a bullish or bearish cycle by monitoring the trend structure of SPY — one of the most widely followed market benchmarks.
Instead of relying solely on individual stock price action, this tool helps traders determine whether the broader market is supportive of long-side momentum and swing trading.
How It Works
The indicator compares:
Daily EMA 20
Daily EMA 50
Market bias is determined as follows:
Bullish Cycle → EMA 20 > EMA 50
Bearish Cycle → EMA 20 < EMA 50
A real-time dashboard displays the current market regime directly on the chart.
Why It’s Useful
Many traders focus only on individual stock setups while ignoring the broader market environment. However, market regime often has a major influence on:
breakout success rates,
momentum continuation,
volatility behavior,
and overall trade expectancy.
This indicator helps traders:
stay aligned with the dominant market trend,
reduce exposure during weak market conditions,
improve trade selection,
and avoid forcing aggressive longs during bearish cycles.
Practical Applications
Example framework:
SPY EMA20 > EMA50 → focus on long setups
SPY EMA20 < EMA50 → defensive positioning / reduced risk
Many professional traders use market regime filters similar to this to improve consistency and reduce low-quality trades during unfavorable market conditions.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.