AutomationFlowsAI & RAG › Generate Intraday Aapl Trade Signals Using Live Data, Openai, Telegram and…

Generate Intraday Aapl Trade Signals Using Live Data, Openai, Telegram and…

Original n8n title: Generate Intraday Aapl Trade Signals Using Live Data, Openai, Telegram and Notion

ByRahul Joshi @rahul08 on n8n.io

This workflow automates short-interval market signal evaluation for intraday trading using live technical indicators and deterministic decision logic. It is designed for traders, analysts, and automation teams who want fast, auditable trade signals without manual chart…

Cron / scheduled trigger★★★★☆ complexityAI-powered24 nodesHTTP RequestAgentOpenAI ChatOutput Parser StructuredTelegramNotionError TriggerGmail
AI & RAG Trigger: Cron / scheduled Nodes: 24 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #12553 — we link there as the canonical source.

This workflow follows the Agent → Error Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "fM8lFP3Rg77GmfWl",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automated Stock Trade Signals Using Live Market Data and Telegram Alerts",
  "tags": [],
  "nodes": [
    {
      "id": "fe300ea2-e997-4b1f-b4ea-a1dda21015ad",
      "name": "Schedule Market Data Polling (AAPL 5-Min)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -832,
        -512
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "215d79e7-d32e-4dc4-802c-4a06ba262171",
      "name": "Fetch AAPL 5-Minute Price & Volume Series",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -608,
        -512
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "4b8972b5-1f3d-414b-ac57-5d5e7356e3ea",
      "name": "Fetch AAPL 20-Period EMA (5-Minute)1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -608,
        -304
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "c2eede50-3250-4ca1-a372-a52fd16fc8bb",
      "name": "Fetch AAPL 14-Period RSI (5-Minute)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -608,
        -704
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "3396c1d2-136d-4589-a1d6-8dc8e93be6c4",
      "name": "Merge RSI, Price, and EMA Streams",
      "type": "n8n-nodes-base.merge",
      "position": [
        -384,
        -528
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "92ebb1cc-433c-401b-9697-dffe89999637",
      "name": "Compute Trend & Momentum Signals ",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        -496
      ],
      "parameters": {
        "jsCode": "// 1\ufe0f\u20e3 RSI (items[0])\nconst rsi = Number(items[0].json.values[0].rsi);\n\n// 2\ufe0f\u20e3 Time Series (items[1])\nconst candle = items[1].json.values[0];\nconst price = Number(candle.close);\nconst volume = Number(candle.volume);\n\n// 3\ufe0f\u20e3 EMA (items[2])\nconst ema = Number(items[2].json.values[0].ema);\n\n// Trend logic\nlet trend = \"NEUTRAL\";\nif (price > ema) trend = \"BULLISH\";\nelse if (price < ema) trend = \"BEARISH\";\n\n// Momentum logic\nlet momentum = \"NEUTRAL\";\nif (rsi >= 60) momentum = \"BULLISH\";\nelse if (rsi <= 40) momentum = \"BEARISH\";\n\nreturn [\n  {\n    json: {\n      price,\n      ema,\n      rsi,\n      volume,\n      trend,\n      momentum\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "beb65838-cf2c-4215-b5ca-e2190310a76d",
      "name": "Evaluate Trade Decision from Signals (AI)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        448,
        -496
      ],
      "parameters": {
        "text": "=Here are the computed trade signals:\n\n{{ JSON.stringify($json, null, 2) }}\n\nReturn ONLY valid JSON in the following format:\n\n{\n  \"verdict\": \"APPROVE | WAIT | REJECT\",\n  \"confidence\": \"HIGH | MEDIUM | LOW\",\n  \"reason\": \"one concise sentence\"\n}\n",
        "options": {
          "maxIterations": 30,
          "systemMessage": "You are a trading decision engine.\n\nRules:\n- Do NOT calculate indicators.\n- Do NOT modify numeric values.\n- Use only the signals provided in the input JSON.\n- Be deterministic and conservative.\n- Do NOT add trading advice, disclaimers, or extra text.\n- Output MUST be valid JSON only.\n\nDecision logic:\n- If trend is \"BULLISH\" AND volume is high AND momentum is \"BULLISH\" \u2192 APPROVE\n- If trend is \"BULLISH\" AND volume is high AND momentum is \"NEUTRAL\" \u2192 WAIT\n- If trend is \"BEARISH\" \u2192 REJECT\n- Otherwise \u2192 REJECT\n\nConfidence rules:\n- APPROVE \u2192 HIGH\n- WAIT \u2192 MEDIUM\n- REJECT \u2192 LOW\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "cf8fed0f-b4bf-4393-91eb-18d51c83cbda",
      "name": "LLM Engine for Trade Decision Reasoning",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        416,
        -272
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {},
        "responsesApiEnabled": false
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "85318c06-30f0-472e-96e3-67dd7e502959",
      "name": "Structured Trade Decision Output Parser ",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        592,
        -256
      ],
      "parameters": {
        "jsonSchemaExample": "[ {\n  \"verdict\": \"WAIT\",\n  \"confidence\": \"MEDIUM\",\n  \"reason\": \"Trend is bullish with strong participation, but momentum remains neutral.\"\n}\n]"
      },
      "typeVersion": 1.3
    },
    {
      "id": "883aa353-5b9d-449c-8294-08621c184849",
      "name": "Route Trade Based on Verdict = APPROVE",
      "type": "n8n-nodes-base.if",
      "position": [
        928,
        -160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cb9b63fc-051f-48e8-a5b2-a35983b093f7",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output[0].verdict }}",
              "rightValue": "=APPROVE"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "04ae0b3f-f55b-4246-87bd-58897a2e35b0",
      "name": "Send Trade Alert \u2014 APPROVED Path (Telegram)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1296,
        -496
      ],
      "parameters": {
        "text": "=\ud83d\udcca Trade Signal Alert\n\n\ud83e\uddfe Verdict: {{ $json.output[0].verdict }}\n\ud83d\udcc8 Confidence: {{ $json.output[0].confidence }}\n\n\ud83e\udde0 Reason:\n{{ $json.output[0].reason }}\n",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7553db69-30ab-427a-b51a-ccec36696751",
      "name": "Send Trade Alert \u2014 NON-APPROVED Path (Telegram)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1344,
        -256
      ],
      "parameters": {
        "text": "=\ud83d\udcca Trade Signal Alert\n\n\ud83e\uddfe Verdict: {{ $json.output[0].verdict }}\n\ud83d\udcc8 Confidence: {{ $json.output[0].confidence }}\n\n\ud83e\udde0 Reason:\n{{ $json.output[0].reason }}\n",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0082819c-14e1-496e-86e4-78e3a961c594",
      "name": "Log Trade Decision to Notion (Market Signals DB)",
      "type": "n8n-nodes-base.notion",
      "position": [
        928,
        -544
      ],
      "parameters": {
        "title": "=data",
        "simple": false,
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "2e0802b9-1fa0-8007-909e-c3ac44c90ea9",
          "cachedResultUrl": "https://www.notion.so/2e0802b91fa08007909ec3ac44c90ea9",
          "cachedResultName": "Market signal analysis"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Analysis data|title",
              "title": "={{ $json.output[0].verdict }}\n{{ $json.output[0].confidence }}\n{{ $json.output[0].reason }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "20960ae3-ddef-4013-8251-dc44dcb7a3c1",
      "name": "Workflow Error Handler",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -576,
        128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ce6ccbc8-fee5-4442-847b-80073a9c8290",
      "name": "Send a message1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -352,
        128
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=\ud83d\udea8 *Workflow Error Alert*  *Error Node:* {{ $json.node.name }} *Error Message:* {{ $json.error.message }} *Timestamp:* {{ $now.toISO() }}  Please investigate immediately.",
        "options": {},
        "subject": "Workflow Error Alert",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cda88f11-28df-4749-aa2d-677f7adc1edb",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 336,
        "content": "## Error Handling\nSends alerts when the workflow fails\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c712e0a0-a5af-4cf3-918d-21d14f27cf8b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        -928
      ],
      "parameters": {
        "width": 736,
        "height": 640,
        "content": "## \ud83d\udcc8 Automated Stock Trade Signals Using Live Market Data and Telegram Alerts\n\n### How it works\nThis workflow runs on a scheduled 5-minute interval to analyze short-term market conditions for AAPL using live technical indicators. It fetches the latest price, volume, RSI, and EMA data from Twelve Data and merges them into a unified market snapshot.\n\nA deterministic calculation layer computes trend and momentum signals without AI involvement, ensuring transparent and auditable indicator logic. These computed signals are then passed to an AI decision engine that applies strict, rule-based logic to determine whether a trade should be approved, delayed, or rejected.\n\nThe AI does not calculate indicators or modify values. It only evaluates the provided signals and returns a structured verdict with confidence and a concise reason. Based on the verdict, the workflow routes alerts to Telegram, logs all decisions to Notion for historical tracking, and ensures every signal is recorded for analysis and audit.\n\nThis setup provides fast, repeatable intraday signal evaluation while maintaining separation between calculation logic and decision logic. It is designed for monitoring and decision support\u2014not autonomous trading execution.\n\n### Setup steps\n1. Set the schedule interval (5-minute polling).\n2. Add Twelve Data API credentials.\n3. Configure OpenAI credentials for decision evaluation.\n4. Set Telegram chat ID for alerts.\n5. Connect Notion database for signal logging.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c183eb1a-9225-4c8d-a1e9-ca501bdea3c4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        -976
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 896,
        "content": "## Market Data Polling\nRuns on a fixed 5-minute schedule and pulls the latest\nAAPL price, volume, RSI, and EMA data from Twelve Data.\nThis ensures all downstream logic works on fresh,\nsynchronized market inputs.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "dfb29082-3423-46b6-9b6b-7a1f253d4861",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -736
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 512,
        "content": "## Signal Computation\nCombines RSI, price, volume, and EMA into a single\nmarket snapshot. Applies deterministic logic to\nderive trend and momentum signals before AI evaluation.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3cd430fb-9901-437d-96e8-0c59c9724714",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        -800
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 736,
        "content": "## AI Trade Decision\nUses a strict, rule-based AI agent to evaluate computed\nsignals and return a structured trade verdict with\nconfidence and a concise reasoning statement.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5bd9a6b2-39e4-4faf-a553-04415e7fef0d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        -352
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 400,
        "content": "## Trade Routing & Alerts\nRoutes trades based on the AI verdict and sends\nreal-time alerts to Telegram so decisions are visible\nimmediately without opening n8n.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2ff30517-8d8c-4cbc-9a33-0827d489c945",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -224
      ],
      "parameters": {
        "color": 3,
        "width": 320,
        "height": 320,
        "content": "## \ud83d\udd10 Required Credentials & Security\n\n- Twelve Data API (market data)\n- OpenAI API (decision evaluation)\n- Telegram Bot API (trade alerts)\n- Notion API (signal logging)\n\nUse environment variables or n8n credentials for all API keys.\nNever hard-code secrets in HTTP nodes.\nLimit API permissions to read-only where possible.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "020d4a5a-e4db-4ea3-8c9f-95c07ac2ef5e",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        -816
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 752,
        "content": "## Telegram Trade Alerts\nDelivers real-time trade verdicts directly to Telegram.\nBoth approved and non-approved decisions are sent,\nensuring visibility without opening n8n. Ideal for\nfast reaction and continuous monitoring.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "aeb326b5-c81c-497a-b160-aff414e40bea",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        -816
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 400,
        "content": "## Audit Logging\nStores all trade decisions for analysis and traceability.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6dd5855c-4f48-417c-95b3-88dd39302cc0",
  "connections": {
    "Workflow Error Handler": {
      "main": [
        [
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compute Trend & Momentum Signals ": {
      "main": [
        [
          {
            "node": "Evaluate Trade Decision from Signals (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge RSI, Price, and EMA Streams": {
      "main": [
        [
          {
            "node": "Compute Trend & Momentum Signals ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch AAPL 14-Period RSI (5-Minute)": {
      "main": [
        [
          {
            "node": "Merge RSI, Price, and EMA Streams",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch AAPL 20-Period EMA (5-Minute)1": {
      "main": [
        [
          {
            "node": "Merge RSI, Price, and EMA Streams",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Route Trade Based on Verdict = APPROVE": {
      "main": [
        [
          {
            "node": "Send Trade Alert \u2014 APPROVED Path (Telegram)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Trade Alert \u2014 NON-APPROVED Path (Telegram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM Engine for Trade Decision Reasoning": {
      "ai_languageModel": [
        [
          {
            "node": "Evaluate Trade Decision from Signals (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Trade Decision Output Parser ": {
      "ai_outputParser": [
        [
          {
            "node": "Evaluate Trade Decision from Signals (AI)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate Trade Decision from Signals (AI)": {
      "main": [
        [
          {
            "node": "Route Trade Based on Verdict = APPROVE",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log Trade Decision to Notion (Market Signals DB)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch AAPL 5-Minute Price & Volume Series": {
      "main": [
        [
          {
            "node": "Merge RSI, Price, and EMA Streams",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Schedule Market Data Polling (AAPL 5-Min)": {
      "main": [
        [
          {
            "node": "Fetch AAPL 20-Period EMA (5-Minute)1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch AAPL 5-Minute Price & Volume Series",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch AAPL 14-Period RSI (5-Minute)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow automates short-interval market signal evaluation for intraday trading using live technical indicators and deterministic decision logic. It is designed for traders, analysts, and automation teams who want fast, auditable trade signals without manual chart…

Source: https://n8n.io/workflows/12553/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

//ASMR AI Workflow

HTTP Request, Tool Think, OpenAI Chat +6
AI & RAG

Act as your personal executive assistant with this high-level automation designed to handle the most tedious post-meeting tasks. This workflow ensures that no action item is forgotten and that partici

HTTP Request, Agent, OpenAI Chat +5
AI & RAG

LinkedIn_Job_Hunt_and_Cover_Letter. Uses outputParserStructured, outputParserAutofixing, googleDrive, agent. Scheduled trigger; 85 nodes.

Output Parser Structured, Output Parser Autofixing, Google Drive +6
AI & RAG

This n8n automation workflow automates the creation, scripting, production, and posting of YouTube videos. It leverages AI (OpenAI), image generation (PIAPI), video rendering (Shotstack), and platform

Agent, OpenAI Chat, Airtable Tool +7
AI & RAG

Created by: Peyton Leveillee Last updated: October 2025

OpenAI Chat, Google Sheets, HTTP Request +5