OPEN-SOURCE SCRIPT
SHAP-Aligned BUY Signal (Daily, Edge-Triggered)

Based on the XGBoost + SHAP interpretation report, I'll explain which indicators to monitor for buying NVO. However, I must emphasize that this model performed poorly (47.5% accuracy) and should NOT be used for actual trading! That said, here's what the model learned (for educational purposes):
📊 Top Indicators to Monitor for BUY Signals
1. Days_Since_Low (Most Important - 1.264)
Direction: BULLISH ↑
Interpretation: Higher values → UP prediction
What to monitor: Track how many days since the stock hit its recent low
Buy signal: When the stock has been recovering for an extended period (e.g., 100+ days from low)
Why it matters: The model learned that stocks in long-term recovery tend to continue rising
2. SMA_50 (50-day Moving Average) (0.413)
Direction: BULLISH ↑
Interpretation: Higher absolute SMA_50 values → UP prediction
What to monitor: The 50-day simple moving average price level
Buy signal: When SMA_50 is at higher levels (e.g., above $80-90)
Why it matters: Higher moving averages indicate stronger long-term trends
3. SMA_200 (200-day Moving Average) (0.274)
Direction: BULLISH ↑
Interpretation: Higher SMA_200 → UP prediction
What to monitor: The 200-day simple moving average
Buy signal: When SMA_200 is trending upward and at elevated levels
Why it matters: Long-term trend indicator; golden cross (SMA_50 > SMA_200) is traditionally bullish
4. BB_Width (Bollinger Band Width) (0.199)
Direction: BULLISH ↑
Interpretation: WIDER Bollinger Bands → UP prediction
What to monitor: The distance between upper and lower Bollinger Bands
Buy signal: When BB_Width is expanding (increasing volatility often precedes trend moves)
Why it matters: Widening bands can signal the start of a new trend
5. Price_SMA_50_Ratio (0.158)
Direction: BULLISH ↑
Interpretation: When price is ABOVE the 50-day MA → UP prediction
What to monitor: Current price ÷ SMA_50
Buy signal: When ratio > 1.0 (price is above the 50-day average)
Why it matters: Price above moving averages indicates uptrend
6. Momentum_21D (21-day Momentum) (0.152)
Direction: BULLISH ↑
Interpretation: Positive 21-day momentum → UP prediction
What to monitor: 21-day rate of change
Buy signal: When momentum is positive and increasing
Why it matters: Positive momentum suggests continuation
7. Stoch_K (Stochastic Oscillator) (0.142)
Direction: BULLISH ↑
Interpretation: Higher Stochastic K → UP prediction
What to monitor: Stochastic oscillator (0-100 scale)
Buy signal: When Stoch_K is rising from oversold (<20) or in mid-range (40-60)
Why it matters: Measures momentum and overbought/oversold conditions
📊 Top Indicators to Monitor for BUY Signals
1. Days_Since_Low (Most Important - 1.264)
Direction: BULLISH ↑
Interpretation: Higher values → UP prediction
What to monitor: Track how many days since the stock hit its recent low
Buy signal: When the stock has been recovering for an extended period (e.g., 100+ days from low)
Why it matters: The model learned that stocks in long-term recovery tend to continue rising
2. SMA_50 (50-day Moving Average) (0.413)
Direction: BULLISH ↑
Interpretation: Higher absolute SMA_50 values → UP prediction
What to monitor: The 50-day simple moving average price level
Buy signal: When SMA_50 is at higher levels (e.g., above $80-90)
Why it matters: Higher moving averages indicate stronger long-term trends
3. SMA_200 (200-day Moving Average) (0.274)
Direction: BULLISH ↑
Interpretation: Higher SMA_200 → UP prediction
What to monitor: The 200-day simple moving average
Buy signal: When SMA_200 is trending upward and at elevated levels
Why it matters: Long-term trend indicator; golden cross (SMA_50 > SMA_200) is traditionally bullish
4. BB_Width (Bollinger Band Width) (0.199)
Direction: BULLISH ↑
Interpretation: WIDER Bollinger Bands → UP prediction
What to monitor: The distance between upper and lower Bollinger Bands
Buy signal: When BB_Width is expanding (increasing volatility often precedes trend moves)
Why it matters: Widening bands can signal the start of a new trend
5. Price_SMA_50_Ratio (0.158)
Direction: BULLISH ↑
Interpretation: When price is ABOVE the 50-day MA → UP prediction
What to monitor: Current price ÷ SMA_50
Buy signal: When ratio > 1.0 (price is above the 50-day average)
Why it matters: Price above moving averages indicates uptrend
6. Momentum_21D (21-day Momentum) (0.152)
Direction: BULLISH ↑
Interpretation: Positive 21-day momentum → UP prediction
What to monitor: 21-day rate of change
Buy signal: When momentum is positive and increasing
Why it matters: Positive momentum suggests continuation
7. Stoch_K (Stochastic Oscillator) (0.142)
Direction: BULLISH ↑
Interpretation: Higher Stochastic K → UP prediction
What to monitor: Stochastic oscillator (0-100 scale)
Buy signal: When Stoch_K is rising from oversold (<20) or in mid-range (40-60)
Why it matters: Measures momentum and overbought/oversold conditions
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.