AutomationFlowsAI & RAG › Discord Forex AI Trading Assistant W/ Proper Position Sizing (metatrader5)

Discord Forex AI Trading Assistant W/ Proper Position Sizing (metatrader5)

ByCj Elijah Garay @elijahbuilds-ai on n8n.io

Trade or buy/sell forex and xauusd/gold assets with this n8n template. It demonstrates an AI-powered Discord bot that monitors trading commands in a private server channel and automatically executes them on MetaTrader 5, using natural language processing to parse flexible trade…

Cron / scheduled trigger★★★★★ complexityAI-powered48 nodesHTTP RequestDiscordChain LlmOpenAI Chat
AI & RAG Trigger: Cron / scheduled Nodes: 48 Complexity: ★★★★★ AI nodes: yes Added:

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

This workflow follows the Chainllm → HTTP Request 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
{
  "nodes": [
    {
      "id": "5a6511d5-a362-4fa5-9ecb-292345917975",
      "name": "parse ai response1",
      "type": "n8n-nodes-base.code",
      "position": [
        3936,
        240
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "a2028cf4-f76b-42f1-b164-03c85da1fafd",
      "name": "Schedule Trigger1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        800,
        784
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "827e4d01-b7d1-476d-ad33-98226d3ae62f",
      "name": "if there is an error1",
      "type": "n8n-nodes-base.if",
      "position": [
        4080,
        128
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "cc21842d-6f8b-4d1a-8447-d50095c48a33",
      "name": "HTTP Request send market order1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3520,
        768
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "efaa4014-dd33-41b5-b3a7-7d2ddf239f31",
      "name": "Get recent message - omni1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        1168,
        784
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "e4507582-fd6b-42d0-a7b0-7c31f0ab202d",
      "name": "Switch2",
      "type": "n8n-nodes-base.switch",
      "position": [
        2224,
        720
      ],
      "parameters": {},
      "typeVersion": 3.3
    },
    {
      "id": "8995f052-bd63-41e2-aea5-40260e92c359",
      "name": "parse LLM output1",
      "type": "n8n-nodes-base.code",
      "position": [
        2064,
        784
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "21e6d39c-cea2-44c5-b6fe-0e1cc78ae826",
      "name": "Trading Assistant Classifier & Responder2",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1840,
        784
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "443d3528-a7a0-4e85-aa7a-b13ac5e50461",
      "name": "React with an emoji to a message1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        1600,
        784
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "6a32aa65-e684-44cb-a588-d13befc03565",
      "name": "Trading Assistant Classifier & Responder3",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        3712,
        240
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "4d27f814-0ddf-4807-9b7c-22bc40e4b265",
      "name": "If trade was successful1",
      "type": "n8n-nodes-base.if",
      "position": [
        4000,
        1040
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "93b3fc60-d293-4177-addd-ede90d9e3162",
      "name": "respond: success1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        4208,
        928
      ],
      "parameters": {},
      "executeOnce": true,
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "f13a6ec3-421f-4a9d-9f48-aac525a79e2c",
      "name": "respond: failed1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        4208,
        1152
      ],
      "parameters": {},
      "executeOnce": true,
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "52c5b9d7-1563-47ea-bd66-604ced1d8b5a",
      "name": "respond: error1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        4240,
        -16
      ],
      "parameters": {},
      "executeOnce": true,
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "0f82c910-c6db-4748-a6b9-18a73eb6204d",
      "name": "Switch3",
      "type": "n8n-nodes-base.switch",
      "position": [
        3264,
        912
      ],
      "parameters": {},
      "typeVersion": 3.3
    },
    {
      "id": "b043d37d-5938-40eb-966c-4d227ef29d5a",
      "name": "HTTP Request send limit order",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3728,
        1040
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "f2043eaf-d9a9-474b-9bbd-d0edde382ff3",
      "name": "parse if AI says content is complete2",
      "type": "n8n-nodes-base.code",
      "position": [
        2480,
        240
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "a8572c97-e33f-4d6d-b5c5-61bb83f8b6ce",
      "name": "needs LLM fallback?1",
      "type": "n8n-nodes-base.switch",
      "position": [
        2672,
        224
      ],
      "parameters": {},
      "typeVersion": 3.3
    },
    {
      "id": "023e56c7-8f8a-4a75-92c3-2b832dba2e44",
      "name": "respond: something is missing",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        2848,
        352
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "b7bb9116-774b-4483-9078-3489d2bf37a2",
      "name": "LLM fallback1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        3552,
        -80
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "915e7946-b63c-42c3-aeea-5bcc2e23b1df",
      "name": "parse if AI says content is complete3",
      "type": "n8n-nodes-base.code",
      "position": [
        3136,
        32
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "1c375d63-090c-4fdf-b6a8-66a9278cb190",
      "name": "basic LLM fallback check1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2848,
        32
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "88b3e2fc-abb3-49fe-8580-0b56be7f3e8a",
      "name": "http error response1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        3520,
        1232
      ],
      "parameters": {},
      "executeOnce": true,
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "88a056e1-e892-480d-8596-2a5984f6a800",
      "name": "parameters are missing?1",
      "type": "n8n-nodes-base.if",
      "position": [
        3344,
        32
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "b18ceeae-5b62-456e-8821-3c579b3a616b",
      "name": "4o - mini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2848,
        176
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "931edefd-eea6-419a-8c3e-02e706ffc59b",
      "name": "If ai says complete1",
      "type": "n8n-nodes-base.if",
      "position": [
        3552,
        144
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "db19659c-38f6-4981-a90a-1237c2dd5326",
      "name": "4o mini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1968,
        1040
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "0a9aef37-1c89-495a-84e2-e44ca6719acd",
      "name": "Parse switch output1",
      "type": "n8n-nodes-base.code",
      "position": [
        3520,
        944
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "ce4b83d0-7905-49ce-adcf-31aa45114d5c",
      "name": "resond get signals2",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        2928,
        1008
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "01a4a472-7b34-459b-8805-6f0d4b066569",
      "name": "HTTP get pending signals1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2512,
        1104
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "78a0e32b-9da2-4978-8f6b-574afdc06661",
      "name": "if there is signal1",
      "type": "n8n-nodes-base.if",
      "position": [
        2720,
        1104
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "239aaf02-2b49-4f92-a366-25c6366856b4",
      "name": "resond get signals3",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        2928,
        1184
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "02a4ed30-81d5-4884-bb53-bb416c94732f",
      "name": "clear signals response1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        2704,
        1456
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "26c18fca-ff4b-4ee2-a38d-1abebeb0c04f",
      "name": "Http req clear all signals1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2496,
        1456
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "8753b4dd-d061-495d-aa09-8657bd069c77",
      "name": "4o mini3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        3712,
        400
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "c697a20f-2163-4d7a-acb0-9ac2d1564ad5",
      "name": "set credentials and params1",
      "type": "n8n-nodes-base.set",
      "position": [
        976,
        784
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "45434b78-3864-4c28-8a07-c5f0a8324be3",
      "name": "only get user's message that has no reacts1",
      "type": "n8n-nodes-base.filter",
      "position": [
        1376,
        784
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "65692b39-c8cf-4e0e-ae5a-937739db08eb",
      "name": "respond: query1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        2512,
        720
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "54370283-dcc7-4099-b5d0-3d7e7a54ef45",
      "name": "respond: help instructions1",
      "type": "n8n-nodes-base.discord",
      "maxTries": 5,
      "position": [
        2720,
        896
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "4c52643c-035f-4cd2-b5ae-11f6e626a132",
      "name": "ai agent instructions1",
      "type": "n8n-nodes-base.set",
      "position": [
        2512,
        896
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "1270b58f-afbd-43d5-846b-1afd7fd18e92",
      "name": "\ud83d\udccb Overview1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        -112
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "77b60990-b969-4cb7-a31c-6e07b2679ca3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2432,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ce258de0-b4cc-40e9-9957-afe260eac0fb",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2432,
        1376
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "27dad970-258c-4a8f-9e72-54e8ee705393",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6e778919-7086-43d8-9525-6416b458dcfb",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1792,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "80abfda0-069b-4f26-bc3f-e7a1e998beb6",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2432,
        -112
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b98ec184-c7d3-4b69-a777-2858fa66bcd6",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3216,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "56fae9fb-621c-4aa4-b0cb-75a770fb9abd",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        -112
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Switch2": {
      "main": [
        [
          {
            "node": "parse if AI says content is complete2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "respond: query1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "respond: query1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ai agent instructions1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP get pending signals1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Http req clear all signals1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch3": {
      "main": [
        [
          {
            "node": "HTTP Request send market order1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request send market order1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse switch output1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request send limit order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "http error response1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4o mini1": {
      "ai_languageModel": [
        [
          {
            "node": "Trading Assistant Classifier & Responder2",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "4o mini3": {
      "ai_languageModel": [
        [
          {
            "node": "Trading Assistant Classifier & Responder3",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "4o - mini1": {
      "ai_languageModel": [
        [
          {
            "node": "basic LLM fallback check1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "set credentials and params1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse LLM output1": {
      "main": [
        [
          {
            "node": "Switch2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse ai response1": {
      "main": [
        [
          {
            "node": "if there is an error1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "if there is signal1": {
      "main": [
        [
          {
            "node": "resond get signals2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "resond get signals3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If ai says complete1": {
      "main": [
        [
          {
            "node": "if there is an error1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Trading Assistant Classifier & Responder3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse switch output1": {
      "main": [
        [
          {
            "node": "HTTP Request send limit order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "needs LLM fallback?1": {
      "main": [
        [
          {
            "node": "basic LLM fallback check1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Trading Assistant Classifier & Responder3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "respond: something is missing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "if there is an error1": {
      "main": [
        [
          {
            "node": "respond: error1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Switch3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ai agent instructions1": {
      "main": [
        [
          {
            "node": "respond: help instructions1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If trade was successful1": {
      "main": [
        [
          {
            "node": "respond: success1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "respond: failed1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parameters are missing?1": {
      "main": [
        [
          {
            "node": "LLM fallback1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If ai says complete1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP get pending signals1": {
      "main": [
        [
          {
            "node": "if there is signal1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "basic LLM fallback check1": {
      "main": [
        [
          {
            "node": "parse if AI says content is complete3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get recent message - omni1": {
      "main": [
        [
          {
            "node": "only get user's message that has no reacts1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Http req clear all signals1": {
      "main": [
        [
          {
            "node": "clear signals response1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set credentials and params1": {
      "main": [
        [
          {
            "node": "Get recent message - omni1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request send limit order": {
      "main": [
        [
          {
            "node": "If trade was successful1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request send market order1": {
      "main": [
        [
          {
            "node": "If trade was successful1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "React with an emoji to a message1": {
      "main": [
        [
          {
            "node": "Trading Assistant Classifier & Responder2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse if AI says content is complete2": {
      "main": [
        [
          {
            "node": "needs LLM fallback?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse if AI says content is complete3": {
      "main": [
        [
          {
            "node": "parameters are missing?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trading Assistant Classifier & Responder2": {
      "main": [
        [
          {
            "node": "parse LLM output1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trading Assistant Classifier & Responder3": {
      "main": [
        [
          {
            "node": "parse ai response1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "only get user's message that has no reacts1": {
      "main": [
        [
          {
            "node": "React with an emoji to a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

Trade or buy/sell forex and xauusd/gold assets with this n8n template. It demonstrates an AI-powered Discord bot that monitors trading commands in a private server channel and automatically executes them on MetaTrader 5, using natural language processing to parse flexible trade…

Source: https://n8n.io/workflows/11440/ — 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

Automate Blog Creation and Publishing with Ultra-Low Cost AI

Chain Llm, WordPress, HTTP Request +6
AI & RAG

Complete PostgreSQL-backed system: Keyword scoring → AI research → Multi-part content generation → fal.ai Nano Banana image generation → WordPress publishing

WordPress, OpenAI, Perplexity +8
AI & RAG

This workflow automates the creation, rendering, approval, and posting of TikTok-style POV (Point of View) videos to Instagram, with cross-posting to Facebook and YouTube. It eliminates manual video p

OpenAI Chat, Output Parser Item List, HTTP Request +10
AI & RAG

This workflow searches the internet for the latest news in your niche, selects the most interesting topics, writes complete long-form SEO articles with AI-generated images, and publishes them directly

Agent, OpenAI Chat, @Brave/N8N Nodes Brave Search +5
AI & RAG

YOUTUBE GUIDE 📣 This template generates up to 2,000 AI-based stock images per day for under $4. It includes prompt generation, image creation, metadata enrichment, upload to Google Drive, and error lo

Google Sheets, HTTP Request, Google Drive +6