{
  "name": "Crypto RSI alert system with EODHD, Telegram and TradingView charts",
  "nodes": [
    {
      "id": "m1",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -520,
        -160
      ]
    },
    {
      "id": "note_overview",
      "name": "Sticky Note — Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -360
      ],
      "parameters": {
        "width": 860,
        "height": 260,
        "content": "## Crypto RSI Alert Bot (overview)\n- Runs on a schedule or manual trigger.\n- Iterates a **watchlist** (BTC/ETH/SOL).\n- Fetches **intraday 1h** OHLCV from **EODHD** for each symbol.\n- Code node compute"
      }
    },
    {
      "id": "set1",
      "name": "Edit Fields (watchlist)",
      "type": "n8n-nodes-base.set",
      "position": [
        -300,
        -160
      ]
    },
    {
      "id": "note_watchlist",
      "name": "Sticky Note — Watchlist",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -300
      ],
      "parameters": {
        "width": 560,
        "height": 160,
        "content": "### Edit Fields (watchlist)\n- Defines the **symbol array**.\n- Make sure the field type is **Array** (String[]), not a single String.\n- Example output: `{ symbol: [\"BTC-USD.CC\",\"ETH-USD.CC\",\"SOL-USD.CC"
      }
    },
    {
      "id": "split_out",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -80,
        -160
      ]
    },
    {
      "id": "note_split",
      "name": "Sticky Note — Split Out",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -300
      ],
      "parameters": {
        "width": 520,
        "height": 150,
        "content": "### Split Out\n- Explodes the array into **one item per symbol**.\n- Input: 1 item with array → Output: N items like `{ symbol: \"BTC-USD.CC\" }`."
      }
    },
    {
      "id": "loop",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        140,
        -160
      ]
    },
    {
      "id": "note_loop",
      "name": "Sticky Note — Loop",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        -300
      ],
      "parameters": {
        "width": 560,
        "height": 120,
        "content": "### Loop Over Items\n- Processes **one symbol per pass** to avoid mixing BTC/ETH/SOL candles.\n- Wiring: **Loop → HTTP → Code → back to Loop**. **Done → IF**."
      }
    },
    {
      "id": "http",
      "name": "HTTP Request (EODHD intraday 1h)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        360,
        -260
      ]
    },
    {
      "id": "note_http",
      "name": "Sticky Note — HTTP",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        -420
      ],
      "parameters": {
        "width": 560,
        "height": 160,
        "content": "### HTTP (EODHD)\n- Fetches **intraday 1h OHLCV** for current symbol.\n- Token via env var `EODHD_TOKEN` → no secret in JSON.\n- **Split Into Items** enabled: 1 candle = 1 item (~2–3k items)."
      }
    },
    {
      "id": "code",
      "name": "Code (RSI + message)",
      "type": "n8n-nodes-base.code",
      "position": [
        580,
        -260
      ]
    },
    {
      "id": "note_code",
      "name": "Sticky Note — Code",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -420
      ],
      "parameters": {
        "width": 560,
        "height": 170,
        "content": "### Code (RSI + message)\n- Sorts candles, computes **RSI(14)** (Wilder), detects 30/70 crossings.\n- Builds HTML message + TradingView URL (BINANCE/USD).\n- Testing: set `FORCE_ALERT = true`, then back "
      }
    },
    {
      "id": "if",
      "name": "IF (has signal?)",
      "type": "n8n-nodes-base.if",
      "position": [
        140,
        40
      ]
    },
    {
      "id": "tg",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        360,
        40
      ]
    },
    {
      "id": "note_tg",
      "name": "Sticky Note — Telegram",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        180
      ],
      "parameters": {
        "width": 560,
        "height": 140,
        "content": "### Telegram (delivery)\n- Parse Mode: **HTML**.\n- Text: `{{$json.alertTextHtml}}`.\n- Button: **View chart** → `{{$json.tradingViewUrl}}`.\n- Chat ID via env var `TELEGRAM_CHAT_ID`.\n- Bot token stays in"
      }
    }
  ],
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "IF (has signal?)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request (EODHD intraday 1h)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF (has signal?)": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code (RSI + message)": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields (watchlist)": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request (EODHD intraday 1h)": {
      "main": [
        [
          {
            "node": "Code (RSI + message)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Edit Fields (watchlist)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}