{
  "id": "z8KRpeAysfJg7kBe",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Tesla 1hour Indicators Tool n8n",
  "tags": [],
  "nodes": [
    {
      "id": "90fa1515-d645-49cc-bbe9-88efc7c05bc2",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -220,
        320
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "message"
            },
            {
              "name": "sessionId"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "2123925c-429b-4bb0-b9fd-d12df9346864",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        340,
        620
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "932cb634-cf3c-4af1-87b1-493163f276a4",
      "name": "Tesla 1hour Indicators Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        220,
        320
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "options": {
          "systemMessage": "You are the **Tesla 1-Hour Technical Indicators Analyst AI**, an expert agent responsible for analyzing Tesla (TSLA) market conditions on the **1-hour timeframe** using a rich set of technical indicators. Your mission is to interpret trend dynamics, momentum shifts, and volatility patterns to support the Tesla Financial Market Analyst Agent in producing actionable trading reports.\n\n---\n\n### \ud83d\udd17 **System Architecture & Tools**\n\nYou operate within an n8n-based modular architecture, using **webhook-triggered HTTP tools** to fetch and format indicator data. These tools call Alpha Vantage premium API endpoints and return the **last 20 datapoints** per indicator in a clean JSON format.\n\nYou are connected to:\n\n* \ud83e\uddee `RSI` \u2013 Relative Strength Index\n* \ud83d\udcc9 `BBANDS` \u2013 Bollinger Bands\n* \ud83d\udd01 `SMA` \u2013 Simple Moving Average\n* \ud83d\udd00 `EMA` \u2013 Exponential Moving Average\n* \ud83d\udcca `ADX` \u2013 Average Directional Index\n* \u2699\ufe0f `MACD` \u2013 Moving Average Convergence Divergence\n* \ud83e\udde0 Simple Memory Module for short-term context retention\n* \ud83e\udd16 Gemini Pro or GPT-4.1 (as the reasoning LLM)\n* \ud83d\udd04 Downstream Tesla Financial Market Analyst Tool (via workflow call)\n\n---\n\n### \ud83d\udd04 **Data Pipeline**\n\nEach indicator is fetched through a dedicated HTTP request node, and processed by a connected Code Node that limits the response to the latest 20 data points. The resulting values are passed into this agent for reasoning and output generation.\n\nExample structure of formatted indicator input:\n\n```json\n{\n  \"indicator\": \"RSI\",\n  \"timeframe\": \"60min\",\n  \"data\": {\n    \"2024-05-03 19:00\": { \"RSI\": \"55.32\" },\n    ...\n  }\n}\n```\n\n---\n\n### \ud83d\udccc **Your Tasks**\n\n1. **Parse** the latest (most recent timestamp) value from each indicator's JSON payload.\n2. **Interpret** how the indicators align to describe Tesla\u2019s current **1-hour trend**:\n\n   * Trending / Consolidating / Reversing\n   * Overbought / Oversold conditions\n   * Strength of momentum or weakening signals\n3. **Output** a structured JSON object containing:\n\n   * A short textual summary of the mid-term trend\n   * Latest values for each indicator\n\n---\n\n### \u2705 **Expected Output Format**\n\n```json\n{\n  \"summary\": \"TSLA is gaining strength on the 1-hour chart. RSI is rising, MACD has crossed bullish, and BBANDS are widening with price riding the upper band.\",\n  \"timeframe\": \"1h\",\n  \"indicators\": {\n    \"RSI\": 62.1,\n    \"BBANDS\": {\n      \"upper\": 176.90,\n      \"lower\": 169.70,\n      \"middle\": 173.30,\n      \"close\": 176.30\n    },\n    \"SMA\": 174.20,\n    \"EMA\": 175.60,\n    \"ADX\": 27.5,\n    \"MACD\": {\n      \"macd\": 0.84,\n      \"signal\": 0.65,\n      \"histogram\": 0.19\n    }\n  }\n}\n```\n\n---\n\nOnly deliver conclusions supported by the most recent data. Be precise and analytical. Your output is consumed by higher-level AI agents for both **spot** and **leveraged trade** signal generation.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "9cadd77f-4bd8-4fb3-8a28-abb752d46d1a",
      "name": "1hour Data",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        720,
        600
      ],
      "parameters": {
        "url": "https://treasurium.app.n8n.cloud/webhook/1hourData",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "d5506353-220b-4d69-944b-e9e8717fff12",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        40,
        640
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "gpt-4.1"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d466ec91-0f23-450e-9d3e-a37ebd3066fe",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        120
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "height": 380,
        "content": "## Trigger from Parent Workflow \nThis node activates the workflow when called to execute Workflow action from the **Tesla Financial Market Analyst Tool**. Ensure proper inputs **message, sessionId** are passed."
      },
      "typeVersion": 1
    },
    {
      "id": "d115f574-e14c-4ec9-b406-c8aae73c7811",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        580
      ],
      "parameters": {
        "color": 2,
        "height": 380,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n## GPT Model for Reasoning \nUtilizes **OpenAI GPT-4.1** to interpret **technical indicators** and generate short-term and long-term trend analysis and structured **JSON output**."
      },
      "typeVersion": 1
    },
    {
      "id": "9886237d-db10-4aef-9d90-9c107aded17a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        580
      ],
      "parameters": {
        "color": 3,
        "height": 380,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n## Short-Term Memory Module\nMaintains context across requests within the same session. Supports consistent logic between indicator evaluations for the **Tesla Financial Market Analyst Tool**."
      },
      "typeVersion": 1
    },
    {
      "id": "b45a3a53-75b6-4d81-92e4-670ab1ad9509",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        560
      ],
      "parameters": {
        "color": 6,
        "height": 480,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n## 1-Hour Indicator Data from Alpha Vantage \nMakes an HTTP call to a secured **webhook**, which fetches Tesla 1-hour interval indicators **(RSI, BBANDS, SMA, EMA, ADX, MACD)** via **Alpha Vantage Premium API**.\nOnly the latest **20 values** are returned, cleaned and trimmed."
      },
      "typeVersion": 1
    },
    {
      "id": "be264bc5-7476-4b75-9179-424817016f71",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        60
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 440,
        "content": "## Tesla 1-hour Technical Indicators AI\n\n\u2022 Processes the **webhook data** and **performs hourly timeframe evaluation for TSLA**.\n\n\u2022 Outputs a **JSON summary** of **market condition, trend state, and all indicator values**.\n\n\u2022 This feeds into the broader **Tesla Financial Market Data Analyst**."
      },
      "typeVersion": 1
    },
    {
      "id": "4451336c-206e-4580-a386-bff3e8adeb35",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -1140
      ],
      "parameters": {
        "width": 1520,
        "height": 2180,
        "content": "\n## \ud83d\udcd8 Tesla 1hour Indicators Tool\n\n### \ud83d\udd27 Purpose:\n\nThis tool analyzes Tesla (TSLA) market conditions on the **1-hour timeframe** using a comprehensive set of technical indicators. It identifies **momentum shifts**, **trend strength**, and **volatility patterns**, and feeds this intelligence into the **Tesla Financial Market Data Analyst Tool** for further signal refinement.\n\n---\n\n### \ud83d\udcc2 Required Dependencies (to use this workflow):\n\nTo function properly, you must also have:\n\n* \u2705 Tesla Financial Market Data Analyst Tool (calls this agent)\n* \u2705 Tesla 1hour Webhook Tool (delivers Alpha Vantage indicator data)\n* \u2705 Alpha Vantage Premium API Key (linked via HTTP Query Auth Credential)\n\n---\n\n### \ud83d\udee0\ufe0f Step-by-Step Installation:\n\n1. **Import Workflow**\n   Import this JSON file into your n8n instance.\n\n2. **Set up Credentials**\n\n   * Go to **n8n \u2192 Credentials**\n   * Create new **HTTP Query Auth** credential:\n\n     * Name it: `Alpha Vantage Premium`\n     * Set the query parameter key to `apikey` and value to your Premium API key\n\n3. **Link to Data Feed**\n   This workflow expects **pre-cleaned 1h indicator data** (RSI, BBANDS, SMA, EMA, ADX, MACD) to be delivered via:\n   \ud83d\udc49 `Tesla_Quant_Technical_Indicators_Webhooks_Tool`\n\n4. **Check and Connect Nodes**\n\n   * `1hour Data` \u2192 HTTP tool that fetches Alpha Vantage data via webhook\n   * `Tesla 1hour Indicators Agent` \u2192 AI Reasoning node analyzing cleaned input\n   * `Simple Memory` \u2192 Stores short-term context within session\n   * `OpenAI Chat Model` \u2192 GPT-4.1 (or Gemini Pro) powers the analysis\n\n---\n\n### \ud83e\udde0 AI Agent Logic:\n\n* Fetches the latest 20 datapoints per indicator\n* Parses and evaluates the **most recent timestamp** from each stream\n* Determines the 1h trend status:\n\n  * Trending / Consolidating / Reversing\n  * Overbought / Oversold\n  * Strong / Weak momentum\n* Outputs structured JSON like:\n\n```json\n{\n  \"summary\": \"TSLA is gaining strength on the 1-hour chart. RSI is rising, MACD has crossed bullish, and BBANDS are widening.\",\n  \"timeframe\": \"1h\",\n  \"indicators\": {\n    \"RSI\": 62.1,\n    \"BBANDS\": {\n      \"upper\": 176.90,\n      \"lower\": 169.70,\n      \"middle\": 173.30,\n      \"close\": 176.30\n    },\n    \"SMA\": 174.20,\n    \"EMA\": 175.60,\n    \"ADX\": 27.5,\n    \"MACD\": {\n      \"macd\": 0.84,\n      \"signal\": 0.65,\n      \"histogram\": 0.19\n    }\n  }\n}\n```\n\n---\n\n### \ud83d\udd01 Trigger Flow:\n\n* This agent does **not run independently**\n* It\u2019s triggered **on demand** by:\n  \ud83d\udc49 `Tesla Financial Market Data Analyst Tool`\n\n---\n\n## \ud83d\ude80 Support & Licensing\n\n\ud83d\udd17 **Don Jayamaha \u2013 LinkedIn**\n[http://linkedin.com/in/donjayamahajr](http://linkedin.com/in/donjayamahajr)\n\n\u00a9 2025 Treasurium Capital Limited Company. All rights reserved.\nThis AI workflow architecture, including logic, design, and prompt structures, is the intellectual property of Treasurium Capital Limited Company. Unauthorized reproduction, redistribution, or resale is prohibited under U.S. copyright law. Licensed use only.\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "37db759d-0600-4a72-bc73-5986de68d1ea",
  "connections": {
    "1hour Data": {
      "ai_tool": [
        [
          {
            "node": "Tesla 1hour Indicators Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Tesla 1hour Indicators Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Tesla 1hour Indicators Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Tesla 1hour Indicators Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}