Spaces:
Sleeping
Sleeping
Download regime_engine.py from 404chain/Signal_bot: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/spaces/404chain/Signal_bot/resolve/main/regime_engine.py
- Command line
-
hf download hf://spaces/404chain/Signal_bot/regime_engine.py
-
curl -L -o regime_engine.py https://huggingface.co/spaces/404chain/Signal_bot/resolve/main/regime_engine.py
2.23 kB
| # ========================================================= | |
| # MARKET REGIME ENGINE | |
| # ========================================================= | |
| def detect_market_regime(ta): | |
| rsi = ta["rsi"] | |
| macd = ta["macd"] | |
| trend = ta["trend"] | |
| confidence = ta["confidence"] | |
| regime = "NEUTRAL" | |
| description = "" | |
| # ===================================================== | |
| # OVERBOUGHT | |
| # ===================================================== | |
| if rsi >= 70: | |
| regime = "OVERBOUGHT" | |
| description = ( | |
| "Market terlalu panas. " | |
| "Potensi pullback meningkat." | |
| ) | |
| # ===================================================== | |
| # OVERSOLD | |
| # ===================================================== | |
| elif rsi <= 30: | |
| regime = "OVERSOLD" | |
| description = ( | |
| "Market oversold. " | |
| "Potensi rebound meningkat." | |
| ) | |
| # ===================================================== | |
| # STRONG BULLISH | |
| # ===================================================== | |
| elif trend == "BULLISH" and confidence >= 75: | |
| regime = "STRONG BULLISH" | |
| description = ( | |
| "Momentum bullish kuat. " | |
| "Trend continuation dominan." | |
| ) | |
| # ===================================================== | |
| # STRONG BEARISH | |
| # ===================================================== | |
| elif trend == "BEARISH" and confidence >= 75: | |
| regime = "STRONG BEARISH" | |
| description = ( | |
| "Tekanan bearish kuat. " | |
| "Risk high volatility." | |
| ) | |
| # ===================================================== | |
| # SIDEWAYS | |
| # ===================================================== | |
| elif confidence < 60: | |
| regime = "SIDEWAYS" | |
| description = ( | |
| "Market sedang ranging " | |
| "dan tidak punya arah kuat." | |
| ) | |
| # ===================================================== | |
| # DEFAULT | |
| # ===================================================== | |
| else: | |
| regime = "NEUTRAL" | |
| description = ( | |
| "Momentum market moderat." | |
| ) | |
| return { | |
| "regime": regime, | |
| "description": description | |
| } |