RSI + Moving Average Crossover Alert
fetches recent candles for a trading pair, computes RSI and a simple moving average, then sends a Telegram alert when price crosses the MA or when RSI is oversold or overbought.
Config
- Trading pair (required): Symbol (e.g. BTC/USDT). Used for market data and in the alert.
- Market type (optional, default: spot): Spot or perpetual. Affects which market’s candles are used.
- Kline interval (optional, default: 1h): Candle timeframe for the indicators.
- RSI period (optional, default: 14): Lookback period for RSI.
- Moving average period (optional, default: 20): Lookback period for the SMA.
- RSI oversold threshold (optional, default: 30): Alert when RSI is below this.
- RSI overbought threshold (optional, default: 70): Alert when RSI is above this.
- Binance API (required): API keys used to fetch OHLCV from Binance.
- Telegram (optional): If provided, alerts are sent to this chat; otherwise the workflow only outputs the result.
Logic
- Read trading pair, market type, interval, and indicator parameters from config.
- Fetch enough OHLCV candles from Binance for RSI and SMA.
- Compute RSI and SMA; detect whether the latest close crossed above or below the SMA, and whether RSI is oversold or overbought.
- If any condition is met and Telegram is configured, send one message summarizing the state (RSI, SMA, close, and which conditions triggered).
- Finish and return the computed values and flags (crossAbove, crossBelow, isOversold, isOverbought, alertSent).
When it stops: After a single run (one-off).
If something fails: Errors (e.g. API or Telegram) propagate; no retry.