Forex AI trading assistant for Telegram using chatGPT-4o (with Position Sizing)
MT5 AI Trading Assistant - Telegram Bot Workflow with position sizing capabilities Open trades for forex/xauusd/gold with this n8n template. It demonstrates how to automate MetaTrader 5 trading executions through natu...
Template notes
MT5 AI Trading Assistant - Telegram Bot Workflow with position sizing capabilities
Open trades for forex/xauusd/gold with this n8n template. It demonstrates how to automate MetaTrader 5 trading executions through natural language commands via Telegram, enabling hands-free trade management with AI-powered intent classification and parameter parsing.
Use cases are many
Try executing market orders right away when you see an opportunity using commands, setting up limit orders with precise entry points, or managing pending signals directly from your phone! This workflow handles everything from simple "buy EU 1% 30 pip SL and 3R TP" commands to complex limit orders with risk-reward calculations.
Good to know
This template is for educational purposes only - requires significant security hardening before live trading use OpenAI API costs apply - approximately $0.0001-0.0005 per message depending on complexity Webhook endpoints are NOT authenticated by default - you must add authentication before production deployment or if you want extra security No built-in position size limits - add validation to cap maximum risk percentage MT5 Expert Advisor required - this workflow only sends signals; you need a separate EA to execute trades Local/VPS deployment recommended - not suitable for public cloud without security hardening Always test with demo accounts first - automated trading involves substantial risk of loss
How it works
The Telegram Chat Trigger listens for incoming messages from authorized users in your Telegram bot A reaction emoji (👍) is immediately sent to acknowledge message receipt using the Telegram API The first AI classifier (GPT-4o mini) analyzes the message intent and categorizes it into six types: trade execution, trade inquiry, help request, signal query, signal clear, or off-topic For trade execution commands, a regex-based parser extracts parameters (asset, direction, risk, stop loss, take profit) from natural language If initial parsing is incomplete or confidence is low, an LLM fallback parser attempts to extract missing parameters with strict validation Complete trade parameters are routed through a Switch node to determine order type (market vs limit) Market orders trigger an HTTP POST to webhook/mt5-market-order with asset, direction, risk, SL, and TP parameters Limit orders include an additional entry price parameter and route to webhook/mt5-limit-order For signal queries, the workflow fetches pending signals from webhook/mt5-signals and formats the response Signal clearing commands POST to webhook/mt5-clear-all to remove all pending orders Trade execution success/failure is validated and appropriate confirmation messages are sent back to Telegram Help requests receive multi-part instructional messages with command examples and formatting guidelines