Quick overview
This workflow runs every 5 minutes during active forex market hours, pulls recent candle data from OANDA for three technical strategies, and when a BUY/SELL signal appears it sizes the trade from account balance and risk settings, places a market order on OANDA, and sends a Telegram alert.
How it works
- Runs every 5 minutes on a schedule and stops execution during the defined weekend market closure window (Fri 18:00 UTC to Sun 21:00 UTC).
- Sets per-strategy inputs (instrument, timeframe, risk percentage, OANDA account ID, and Telegram destination) for three parallel strategy paths.
- Fetches the latest 50 candles from the OANDA Instruments Candles endpoint for each strategy’s instrument and timeframe.
- Calculates trade signals using three algorithms: EMA momentum (EMA9/EMA20 with touch confirmation), RSI breakout with SMA trend filter and ATR-based stops, and MACD crossover.
- Merges the strategy outputs and filters out any results where the signal is “none”.
- Retrieves the OANDA account details to get the current account balance, then calculates position size plus stop-loss and take-profit prices from the configured risk and stop distance.
- Places a MARKET order on OANDA with stop-loss and take-profit attached, and sends a formatted signal/execution message to Telegram.
Setup
- Create an OANDA (practice or live) account, generate an API token, and add it in n8n as an HTTP Bearer Auth credential used by the OANDA HTTP Request steps.
- Create a Telegram bot with @BotFather, add it to your target group/channel, and configure a Telegram API credential in n8n.
- Update the three input steps with your instrument, timeframes, risk values, OANDA account IDs, and Telegram chat ID/topic thread ID (and switch OANDA URLs to api-fxtrade.oanda.com if you want live trading).