.
Had to bring another one and one I actually built for a clinet but he didn't want to pay full price, and I wasn't that expensive. But for my channel i like to bring actual ways that work and can make the average person some money, like even blogging on here.
I didn't make this one as advanced as other code files and setups. We researched Quantconnect (for data and backtesting), and you can also go crazier with algorithms (which was a little out of my knowledge study league for the moment), and interactiveBrokers. So I went with Alpaca for the basic API setup and configuration, and with using N8N (AI Automation Tool).
Let's first cover the guide, or you can view the full guide on an interactive webpage. I made a guide cause I like to give people information that they can learn, see, and do on their own. Then, if you would like to purchase the full, already made setup and JSON files for $9.99, then now you can measure whether it's worth it from my teaching and breakdown in the guides. (Yes, I use AI to help me write more and faster sometimes, also, I like the emojis added)
This guide will take you from zero to a working AI‑driven trading workflow running inside n8n that connects to Alpaca. It covers everything you need to know — from importing JSON workflows to connecting APIs and understanding indicator logic.
Core Concepts Before You Start
📍 What Is n8n?
- A workflow automation tool that connects apps and APIs without heavy coding.
- Each workflow is a graph of nodes (steps) — from triggers to logic to HTTP requests.
- Workflows are stored as JSON, which you can import/export.
📍 Alpaca API
- Alpaca is a brokerage API that lets you place trades programmatically (paper or live).
- You’ll need API keys from Alpaca (paper trading for testing).
- These keys go into an HTTP Request node in n8n to place buy/sell orders.
📍 Technical Indicators (RMI, SuperTrend, RSI, etc.)
Indicators are signals based on price data:
- RSI (Relative Strength Index) → overbought/oversold
- RMI → momentum version of RSI
- SuperTrend → trend direction indicator
You can compute these using code nodes or by pulling from a market data API (TwelveData, EODHD).
Set Up Tools You’ll Need
📌 Required Accounts
- n8n — Self‑hosted or cloud account
- Alpaca — Paper trading API keys
- Market Data API — (e.g., TwelveData) for price & indicators
- Google Cloud — For Gmail + Google Sheets (OAuth credentials)
📌 Nodes You’ll Use in n8n
- Schedule Trigger — runs your bot (e.g., every minute during market hours)
- HTTP Request — fetch market data & place trades
- Code Node — compute custom indicators and parse JSON
- Google Sheets — log trades
- Email / Alerts — Gmail or Telegram alerts
Importing a JSON Trading Workflow
n8n workflows are stored as JSON — you can copy/paste entire automation flows:
✔️ How to Import
-
Open your n8n instance
-
Go to Workflows → Create Workflow
-
Click on the canvas and paste the JSON (Ctrl/Cmd + V)
-
n8n auto‑creates all nodes and connections
-
Configure credentials (API keys) inside each relevant node
If a node has a red warning icon after import, it usually means credentials are missing
Building the Workflow (Step‑by‑Step)
🟡 Step 1 — Trigger (Schedule)
Use the Schedule Trigger node
Set it to run every 1–5 minutes during market hours
🔵 Step 2 — Fetch Price Data
Create an HTTP Request node
Pull recent OHLC prices (candles) via a Market Data API
You’ll use this for indicators
Example call for price data (TwelveData or similar):
GET https://api.marketdata.com/v1/quote?symbol=AAPL&interval=1min🟢 Step 3 — Compute Indicators
Use a Code Node to calculate:
RMI
SuperTrend
RSI
Your code should parse the price JSON and output structured indicator values.Example code structure (pseudo‑JS):
const data = items[0].json; const prices = data.priceArray; const rmi = calculateRMI(prices); const superTrend = calculateSuperTrend(prices); return [{json: {rmi, superTrend}}];You can find tutorials on building Code Nodes and handling JSON in n8n online.
🔴 Step 4 — AI Signal Logic (Optional but Recommended)
For more advanced setups, use an AI Agent Node:
It takes your technical data
Outputs structured JSON ⇨
{"signal":"BUY","confidence":0.72}Example prompt:
Analyze this price and indicator data and return BUY or SELL in this JSON format: {"signal":"BUY","confidence":"0.80"}Executing Trades with Alpaca
🟡 HTTP Request Node for Alpaca
Place buy/sell orders using Alpaca:
Example:
POST https://paper-api.alpaca.markets/v2/ordersHeaders: API Key + SecretBody JSON:{ "symbol": "AAPL", "qty": 1, "side": "buy", "type": "market", "time_in_force": "day" }
Repeat with
"side":"sell"for exits.Logging + Alerts
🔹 Google Sheets
Log executed trades with:
Timestamp
Symbol
Price
Signal
P/L
You can do this with the Google Sheets node — just connect your Google OAuth first.
🔹 Alerts
Use Gmail or Telegram nodes to send alerts:
"⚡ Bought AAPL at $X based on RMI/SuperTrend BUY signal"
Putting It All Together — Workflow Logic
[Schedule Trigger]➝ [HTTP Request: Get Price Data]➝ [Code: Compute Indicators]➝ [IF/AI Agent: Decide Signal]➝ [Alpaca Buy/Sell HTTP Calls]➝ [Google Sheets Log]➝ [Email/Telegram Alert]
What You’ll Learn By Doing This
✅ Understanding how indicators work under the hood
✅ How to fetch live market data in real time
✅ Processing and structuring data with JavaScript
✅ Triggering trades based on logic or AI decisions
✅ Logging and automating your entire trading loop
Tips & Best Practices
🔹 Always start with paper trading before going live
🔹 Add risk controls: stop‑loss/take‑profit rules
🔹 Backtest your logic before letting it run
🔹 Use structured JSON outputs so indicators feed cleanly into decision logic
Ready-to-Go Purchase
Get the full n8n workflow JSON + step-by-step setup guide for only $9.99:
Buy the Full AI Scalper Flow Setup Here →
Includes:
✅ Ready-to-import JSON workflow
✅ Step-by-step PDF + video guide
✅ Pre-configured indicator & AI logic nodes
✅ Alpaca paper trading integration
✅ Google Sheet logging + Gmail alerts
Special Offer: Get the full ready-to-use workflow + setup JSON for $9.99 → Buy Here
AI TOOLS & DISCOUNTS



ManyChat (Automation / DMs / Funnels)
