# Oh, I also made an AI Trading Automation

*How about we make money with AI*

By [Futuristic Digital Wealth Agency](https://paragraph.com/@omniai) · 2026-02-12

aitrading, scalperbot, aitradingbot, n8n

---

🚀 _AI Scalper Flow_ — Full Setup Guide & Course (Beginner → Advanced)
======================================================================

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.

* * *

📌 1. 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).
    

* * *

🛠 2. Setup Tools You’ll Need
-----------------------------

📌 **Required Accounts**

1.  **n8n** — Self‑hosted or cloud account
    
2.  **Alpaca** — Paper trading API keys
    
3.  Market Data API — (e.g., TwelveData) for price & indicators
    
4.  **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
    

* * *

🧩 3. Importing a JSON Trading Workflow
---------------------------------------

n8n workflows are stored as JSON — you can **copy/paste entire automation flows**:

### ✔ How to Import

1.  Open your n8n instance
    
2.  Go to **Workflows → Create Workflow**
    
3.  Click on the canvas and **paste** the JSON (Ctrl/Cmd + V)
    
4.  n8n auto‑creates all nodes and connections
    
5.  Configure **credentials** (API keys) inside each relevant node
    

> If a node has a red warning icon after import, it usually means credentials are missing.

* * *

📈 4. 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"}
    

* * *

💰 5. Executing Trades with Alpaca
----------------------------------

### 🟡 HTTP Request Node for Alpaca

Place buy/sell orders using Alpaca:

Example:

    POST https://paper-api.alpaca.markets/v2/orders
    Headers: API Key + Secret
    Body JSON:
    {
      "symbol": "AAPL",
      "qty": 1,
      "side": "buy",
      "type": "market",
      "time_in_force": "day"
    }
    

Repeat with `"side":"sell"` for exits.

* * *

📊 6. 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"

* * *

🚀 7. 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]
    

* * *

🧠 8. 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

* * *

📚 Recommended Resources to Learn More
--------------------------------------

👉 **n8n Beginner → Advanced Guides** — Workflow building fundamentals, code nodes, and APIs explained.  
👉 **Official n8n Docs** — step‑by‑step guides for triggers and nodes.  
👉 **n8n JSON import tutorial** — actually shows how importing works in practice.

[WEBSITE EXPLAINER](https://ai-scalper-flow-ua77lf0.gamma.site/)

Get the **full n8n workflow JSON** + **step-by-step setup guide** for only **$9.99:**

![](https://storage.googleapis.com/papyrus_images/fdf3c38fa46d9021be004bf8f13b36464d1d6a91373843c8c336f8584ce75ff8.png)

[**Buy the Full AI Scalper Flow Setup Here →**](https://buymeacoffee.com/streets2entrepreneurs/e/471861)

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

---

*Originally published on [Futuristic Digital Wealth Agency](https://paragraph.com/@omniai/oh-i-also-made-an-ai-trading-automation)*
