Back to projects
Jan 15, 2026
3 min read

Bitcoin EMA Crossover Alert System

A robust n8n workflow that calculates Exponential Moving Average (EMA) crossovers (9/21 periods) for Bitcoin across multiple timeframes, persisting state in Google Sheets and dispatching real-time trading signals via Telegram.

β‚Ώ Bitcoin EMA Crossover Alert System β€” Automated TA Engine

Bitcoin Indicator Banner

Bitcoin EMA Crossover Alert System is a sophisticated technical analysis engine built entirely within n8n. It automates the monitoring of Bitcoin price trends by calculating 9-period and 21-period Exponential Moving Averages (EMA). When a trend shift is detected via a crossover, the system manages the state, persists the data, and dispatches institutional-grade trading signals to subscribers.

This project demonstrates the capability of low-code automation to handle complex mathematical computations and persistent state management without a traditional backend.


πŸ› οΈ Technology Stack

n8n JavaScript Telegram Google Sheets Node.js JSON


✨ Features at a Glance

πŸ“ˆ Multi-Timeframe Technical Analysis

  • On-the-Fly EMA Computation: Uses custom-coded JavaScript nodes to calculate EMA 9 and EMA 21 from raw candlestick JSON data, bypassing the need for expensive external indicator APIs.
  • Precision Crossover Detection: Identifies Bullish (Golden Cross) and Bearish (Death Cross) signals with absolute accuracy across 5m, 15m, and 1h timeframes.
  • Deduplication Logic: A sophisticated check-and-balance system that ensures only the first signal of a new trend is alerted, preventing notification fatigue.

πŸ’Ύ Persistent Signal State

  • Serverless Database: Leverages Google Sheets as a high-availability state store.
  • Historical Logging: Every signal is archived with price at execution, timestamp, and timeframe for future backtesting.
  • Dynamic Subscriber Routing: Pulls recipient chat IDs in real-time from a β€œSubscribers” sheet, allowing for instant user onboarding.

πŸš€ High-Fidelity Notifications

  • Rich Telegram Signals: Dispatches beautifully formatted messages including emojis, pair name (BTC/USDT), current price, and direction.
  • Automated Retries: Built-in error handling for the Telegram Bot API to ensure signal delivery even during network congestion.

πŸ“ Logic Flow (n8n Nodes)

bitcoin-workflow/
β”œβ”€β”€ Cron Trigger         # Interval-based price fetching
β”œβ”€β”€ API Connector        # Retrieves raw market OHLCV data
β”œβ”€β”€ EMA Calculator [JS]  # Core mathematical engine (Code Node)
β”œβ”€β”€ State Comparator     # Logic node checking Google Sheets
β”œβ”€β”€ Signal Builder [JS]  # Formats the human-readable alert
└── Telegram Dispatcher  # Multi-cast signal delivery

πŸš€ Installation & Setup

1. Prerequisites

  • n8n Instance (Desktop or Cloud)
  • Telegram Bot API Token
  • Google Sheets API Credentials
  • Exchange API Support (Public OHLCV endpoints)

2. Workflow Import

  1. Download the bitcoin-indicator.json from this repository.
  2. In n8n, go to β€œWorkflows” -> β€œImport from File”.
  3. Select the JSON file and import.

3. State Setup

  1. Create a Google Sheet with columns: Timeframe, LastSignal, Timestamp, Price.
  2. Update the Google Sheets nodes in n8n with your Document ID.
  3. Configure the Spreadsheet ID and range for the subscriber list.

4. Customization

  • Adjust the Cron Trigger nodes to your preferred frequency (e.g., every 5 minutes).
  • Edit the EMA Calculator node if you want to use different periods (e.g., 50/200).

πŸ“„ License

Distributed under the MIT License.

Designed & Developed by Aditya (aka aditya-2129)