Skip to main content

Automate stock trades with AI-driven technical analysis & Alpaca Trading

Workflow preview

Workflow preview
100%
Automate stock trades with AI-driven technical analysis & Alpaca Trading preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

AI Powered Stock Analysis & Auto Trading Workflow Supercharge your trading decisions with this end to end AI automation that connects market intelligence, technical analysis, and automated trade...

Best for

  • Crypto Trading automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.toolthink, @n8n/n8n-nodes-langchain.vectorstoresupabase, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, @n8n/n8n-nodes-langchain.rerankercohere, n8n-nodes-base.httprequesttool, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Paul.

Original n8n.io source

1.1 Workflow description

Title
Automate stock trades with AI-driven technical analysis & Alpaca Trading
Workflow name
Automate stock trades with AI-driven technical analysis & Alpaca Trading

📊 AI-Powered Stock Analysis & Auto-Trading Workflow

Supercharge your trading decisions with this end-to-end AI automation that connects market intelligence, technical analysis, and automated trade execution — all without manual intervention.

My results so far:

(100k paper trading account with the current template strategy)

🚀 What This Workflow Does

  • Live AI-Driven Market Scanning
    Integrates with Danelfin’s AI scoring system to identify top stocks daily based on technical, fundamental, sentiment, and risk scores.

  • Advanced Technical & Trend Analysis
    Combines chart patterns, Fibonacci retracements, Bollinger Bands, MACD, RSI, EMA trends, and support/resistance detection with real-time news sentiment to produce clear, professional-grade analysis reports.

  • Chart Image AI Analysis
    Uses LLM-powered vision models to interpret candlestick charts visually and extract pattern, trend, and indicator insights.

  • Automated Trade Execution
    Integrates with Alpaca Paper Trading API for secure, rule-based buy/sell execution.
    Includes:

    • Risk management (position sizing, stop-loss/take-profit)
    • Account balance & buying power checks
    • No-repeat-loss policy
  • Data Storage & Strategy Memory
    Logs trades, PnL, and objectives in PostgreSQL for ongoing strategy refinement.

  • Automated Reporting
    Sends deep-dive market and trade reports directly to your email.


đź”— Integrated Services

  • Danelfin API – AI-based stock ranking
  • Supabase Vector Store – Strategy and knowledge retrieval
  • TwelveData API – Market prices & indicators
  • Chart-img API – TradingView chart generation
  • Alphavantage – News sentiment feed
  • Alpaca API – Automated order execution
  • OpenAI, Anthropic, Cohere, OpenRouter – Multi-model AI reasoning

📥 Perfect For

  • Quantitative analysts testing strategies
  • Investors looking for data-backed, automated execution
  • Educational environments for learning AI-based market strategies
  • People that want to know Real results Results

đź’Ľ What You Get

Full Setup

  • Pre-configured n8n workflow with all nodes and logic ready to run
  • Step-by-step API key integration guide for Danelfin, Alpaca, TwelveData, Alphavantage, Chart-img
  • Database logging setup with PostgreSQL schema
  • Automated email reporting template

Detailed Description

  • Explanation of every sub-agent and AI integration
  • How the strategy agent selects stocks based on AI scores and past trades
  • Deep technical indicators breakdown (EMA, RSI, MACD, Fibonacci, Bollinger, Support/Resistance)
  • Risk management methodology and allocation rules

Examples

  • Daily Automated Analysis: Every morning the system emails you the top 3 stocks to watch, with price, chart, and sentiment score
  • Trade Execution: System buys AAPL with a defined stop-loss and take-profit based on technical setup
  • Chatbot Mode: Ask “What’s the trend on TSLA?” and get a concise, professional-grade market report instantly

💡 Why You’ll Love It

This isn’t just an automation — it’s a full-stack AI trading assistant that thinks, analyzes, and executes while keeping risk in check. From sourcing the idea to placing the trade, it’s all covered.


🔑 Get Started

Replace the placeholder API keys, set your trading preferences, and let the automation do the heavy lifting.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Think

Type / Role
@n8n/n8n-nodes-langchain.toolThink - toolThink
Config choices
Version 1

Block 2 - Supabase Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1.3

Block 3 - Supabase Vector Store1

Type / Role
@n8n/n8n-nodes-langchain.vectorStoreSupabase - vectorStoreSupabase
Config choices
Version 1.3

Block 4 - Embeddings OpenAI

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 5 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1.1

Block 6 - Recursive Character Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 7 - Embeddings OpenAI1

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 8 - Reranker Cohere

Type / Role
@n8n/n8n-nodes-langchain.rerankerCohere - rerankerCohere
Config choices
Version 1

Block 9 - ranking

Type / Role
n8n-nodes-base.httpRequestTool - httpRequestTool
Config choices
Version 4.2

Block 10 - sectors

Type / Role
n8n-nodes-base.httpRequestTool - httpRequestTool
Config choices
Version 4.2

Block 11 - industries

Type / Role
n8n-nodes-base.httpRequestTool - httpRequestTool
Config choices
Version 4.2

Block 12 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Technical Analysis Tool1

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2

Block 14 - Trends Analysis Tool1

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2

Block 15 - Think2

Type / Role
@n8n/n8n-nodes-langchain.toolThink - toolThink
Config choices
Version 1

Block 16 - Edit Fields1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 17 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - OpenRouter Chat Model2

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 19 - Download Chart

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 20 - Get Chart URL

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 21 - Get Price History

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 22 - Get Bollinger Bands

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 23 - Get MACD

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 24 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.1

Showing the first 24 of 96 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Automate stock trades with AI-driven technical analysis & Alpaca Trading
Complexity advanced
Nodes 96
Categories Crypto Trading, Multimodal AI
Author Paul
Published 11 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7240/7240.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate stock trades with AI-driven technical analysis & Alpaca Trading do?

AI Powered Stock Analysis & Auto Trading Workflow Supercharge your trading decisions with this end to end AI automation that connects market intelligence, technical analysis, and automated trade...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Crypto Trading, Multimodal AI use case.