Guides, manuals and platform references.
AlgoWayWS-MT5 EA is the MetaTrader 5 execution bridge for AlgoWay. It connects the AlgoWay platform to your MT5 terminal and lets structured signals from TradingView alerts, Telegram signals, manual webhook tests, or other supported sources become real MT5 trading actions.
This page is the current user-facing guide for the AlgoWayWS-MT5 EA 2.14 workflow. The file name still contains v206 because it originated from an earlier documentation cycle, while the content now reflects the current EA build and current AlgoWay platform direction: TradingView to MT5 webhook automation through AlgoWay and the AlgoWayWS-MT5 Expert Advisor.
All EA settings in this guide are named exactly as users see them in the MetaTrader 5 Inputs tab. Internal MQL variable names are intentionally not used for EA settings.
The complete execution route is:
TradingView alert -> AlgoWay webhook -> AlgoWayWS-MT5 EA -> MetaTrader 5 broker account
This guide explains what the EA does, how webhook JSON fields are interpreted, how trade modes work, how SL/TP and trailing rules are applied, and how to troubleshoot the most common MT5 execution problems.
Last updated: 2026-07-27 • Author: AlgoWay
This page explains the EA behavior and JSON logic. For installation and platform setup, use the dedicated guides below.
| Need | Current guide |
|---|---|
| Install the current MT5 Expert Advisor | How to install an MT5 Expert Advisor for AlgoWay automation |
| Connect TradingView alerts to MT5 | How to connect TradingView to MetaTrader 5 with AlgoWay EA |
| Build a valid AlgoWay webhook message | AlgoWay JSON schema guide |
| Understand SL/TP, trailing and risk logic | Advanced risk management and trade automation |
| Choose Hedge, Reverse, Opposite or Inverse behavior | How AlgoWay handles opposite trading signals |
| Fix MetaTrader 5 EA errors | MetaTrader 5 common errors in AlgoWay |
TradingView is powerful for charting, Pine Script strategies and alerts, but TradingView does not directly execute trades inside your MetaTrader 5 broker terminal. MetaTrader 5 can execute trades through Expert Advisors, but it needs a reliable way to receive the signal from outside.
AlgoWayWS-MT5 EA closes this gap:
Competitors describe the same market need as a TradingView-to-MT5 bridge, webhook-to-EA connector, or alert automation layer. AlgoWay focuses this workflow around a dashboard, structured JSON, WebSocket EA delivery, logs, and multi-source signal routing.
The AlgoWayWS-MT5 EA is an executor. It receives commands routed by AlgoWay and performs trade actions in MetaTrader 5.
The EA can help with:
flat commands;The EA does not create the strategy. It does not guarantee profit. It does not fix a bad TradingView strategy, invalid signal logic, broker spread, slippage, closed market, insufficient margin or unsupported broker settings.
Before expecting the EA to execute orders, confirm these MT5 conditions:
If MT5 returns Error 4752, the EA is probably blocked by algorithmic trading permissions. Read: How to fix MT5 Error 4752.
The key connection value is shown in MT5 as Your Algoway Webhook here. It identifies which AlgoWay webhook route belongs to this MT5 terminal.
| Name shown in MT5 Inputs | Meaning | Example |
|---|---|---|
| Your Algoway Webhook here | AlgoWay webhook UUID or the full https://algoway.co/<uuid> webhook URL. EA 2.14 extracts the UUID from the full URL automatically. |
b7534616-6c8c-4582-8af4-7c143d323231 |
| MAGIC_NUMBER | Magic number used by the EA to identify and manage only its own positions. | 1973 |
If the EA is connected to the wrong webhook, valid alerts can reach AlgoWay but never reach the intended MT5 terminal. Do not attach two active EA instances to the same webhook: the single-instance guard keeps only one instance active.
The names below match the labels visible in the MetaTrader 5 Inputs tab.
| Name shown in MT5 Inputs | What it controls |
|---|---|
| Your Algoway Webhook here | Connects this EA instance to the selected AlgoWay webhook. |
| MAGIC_NUMBER | Identifies positions opened and managed by this EA. |
| Reverse / Hedge / Opposite / Inverse | Selects how incoming BUY and SELL commands interact with existing positions. |
| Coefficient for work with Lots | Multiplies the calculated or supplied order size. |
| Order filling type: AUTO, FOK or IOC | Selects automatic broker-compatible filling, Fill or Kill, or Immediate or Cancel. |
| PIP type: AUTO/TRADINGVIEW/PERCENT | Controls how SL, TP, trailing, breakeven and profit-lock distances are converted. EA 2.14 also contains the POINTS dropdown value. |
Use TView Ticker N1 through TView Ticker N5 together with Broker Ticker N1 through Broker Ticker N5. Each pair replaces the TradingView symbol with the exact MT5 broker symbol.
| Name shown in MT5 Inputs | What it controls |
|---|---|
| Position size: Lots / Risk% / Balance% | Defines whether order_contracts means lots, equity risk percent, or balance percent. |
| LEGACY: force Risk% (by SL) | Compatibility switch for old setup files. When enabled, entry size is forced into Risk% mode and requires a usable Stop Loss. |
| Close size: Lots / Percent % | Defines whether a flat command closes a lot amount or a percent of the initial position size. |
| Name shown in MT5 Inputs | What it controls |
|---|---|
| Enable Trailing SL | Enables the global EA trailing stop. |
| Trailing Step in pips | Distance used when the EA advances Stop Loss. |
| Start trailing after N pips, 0 = immediate | Delays trailing until the position reaches the selected profit distance. |
| Enable Breakeven | Allows the EA to move Stop Loss to the entry area. |
| Move SL to BE after X pips profit | Profit distance required before breakeven activates. |
| Enable Profit Lock factor | Enables protected-profit Stop Loss movement. |
| Profit Lock after XX pips | Profit amount the EA attempts to protect. |
| Delta trigger | Profit threshold that activates Profit Lock. |
| Name shown in MT5 Inputs | What it controls |
|---|---|
| Use fixed SL/TP (pips) inside EA | Uses the fixed EA values instead of alert-provided SL/TP distances for new entries. |
| Do not place SL in MT5 | Prevents the EA from placing Stop Loss in MT5. |
| Do not place TP in MT5 | Prevents the EA from placing Take Profit in MT5. |
| Internal SL distance in pips | Fixed Stop Loss distance used when internal SL/TP is enabled. |
| Internal TP distance in pips | Fixed Take Profit distance used when internal SL/TP is enabled. |
| Name shown in MT5 Inputs | What it controls |
|---|---|
| Enable increasing the lot after a losing trade | Enables lot multiplication after a losing trade. |
| Lot increase coefficient | Multiplier used for the next martingale step. |
| Max daily loss in % | Closes all positions belonging to the EA magic number and blocks new trading until the next New York trading-day reset. Zero disables the limit. |
| Max drawdown per trade in % | Closes an individual EA position when its adverse price movement from the open price reaches the configured percentage. Zero disables the limit. |
| Max positions, if 0 = no limit | Maximum total number of EA positions. |
| Max positions per direction, if 0 = no limit | Maximum number of BUY or SELL positions in one direction. |
| Max spread in points, 0 = disabled | Blocks new entries when the current spread exceeds the configured broker-point value. It does not prevent position-closing commands. |
| Name shown in MT5 Inputs | What it controls |
|---|---|
| NY session: Winter or Summer | Selects the New York trading-day reset: WINTER uses 22:00 UTC and SUMMER uses 21:00 UTC. It does not change the fixed New York session row shown as 12:00-22:00 UTC. |
| London (07:00-16:00) | Allows entries during the fixed London UTC session. |
| New York (12:00-22:00) | Allows entries during the fixed New York UTC session. |
| Tokyo (22:00-07:00) | Allows entries during the fixed Tokyo UTC session. |
| Daily Window Time Mode | Selects the clock used by Daily Trade Window: UTC, broker/server time, or local computer/VPS time. Default is UTC to preserve existing configurations. |
| Daily Trade Window | Allowed daily entry interval in HH:MM-HH:MM format using the selected Daily Window Time Mode. Overnight ranges such as 23:30-21:30 are supported. |
| Autoclose mode | Selects no auto-close, close near the end of the trading day, or close near the end of the trading week. |
| minutes before end | Number of minutes before the calculated day or week end when Auto-Close starts closing EA positions. |
Important time rule: London, New York and Tokyo session rows always use UTC. Daily Window Time Mode changes only the clock used by Daily Trade Window. LOCAL means the Windows/VPS clock. BROKER means the MT5 trading-server clock used by broker history. UTC preserves the behavior of older EA configurations.
| Name shown in MT5 Inputs | What it controls |
|---|---|
| Telegram notify for AlgoWay disconnect | Enables EA notifications when the AlgoWay connection is lost and restored. |
| Telegram chat id | Destination Telegram chat ID. |
| Telegram bot token | Bot token used to send the notification. |
A basic AlgoWay message for MetaTrader 5 contains four main fields:
| Field | Example | Purpose |
|---|---|---|
platform_name |
metatrader5 |
Tells AlgoWay to route the command to MetaTrader 5. |
ticker |
EURUSD |
Defines the trading symbol. It may need mapping to the broker symbol. |
order_contracts |
0.10 |
Defines the size value before final sizing mode and coefficient logic. |
order_action |
buy |
Defines the action: buy, sell, flat, modify or mode-specific action. |
Basic market order:
{
"platform_name": "metatrader5",
"ticker": "EURUSD",
"order_contracts": 0.10,
"order_action": "buy"
}
For a TradingView strategy alert, use TradingView placeholders. TradingView replaces them when the alert fires.
{
"platform_name": "metatrader5",
"ticker": "{{ticker}}",
"order_contracts": "{{strategy.order.contracts}}",
"order_action": "{{strategy.market_position}}",
"price": "{{close}}"
}
If this message reaches AlgoWay but MT5 does not trade, check the EA connection, symbol mapping, lot size, trade mode, broker session, margin and MT5 logs.
| Action | Meaning | Typical use |
|---|---|---|
buy |
Open or process BUY-side command | Long entry |
sell |
Open or process SELL-side command | Short entry |
long |
Directional value treated as BUY where supported | TradingView strategy state mapping |
short |
Directional value treated as SELL where supported | TradingView strategy state mapping |
flat |
Close position logic | Exit signal or partial close workflow |
modify |
Modify an existing position | Update SL/TP by identifier |
The dropdown shown as Reverse / Hedge / Opposite / Inverse defines how the EA behaves when a new signal arrives while a position already exists on the same symbol.
| Mode | Behavior | Best use case |
|---|---|---|
| Reverse | One-side model. The EA closes the opposite side and opens or keeps the new side according to signal logic. | Simple TradingView strategy automation where one side should be active. |
| Hedge | BUY and SELL can exist at the same time if the account supports it. | Hedging systems and independent long/short logic. |
| Opposite | The latest signal controls direction. The current position can be closed and the opposite side opened. | Strategies that flip immediately from long to short or short to long. |
| Inverse | Incoming direction is inverted before execution logic. BUY becomes SELL, SELL becomes BUY. | Counter-signal workflows or inverse strategy execution. |
Detailed mode guide: How AlgoWay handles opposite trading signals.
The same order_contracts value can mean different things depending on the value selected in Position size: Lots / Risk% / Balance%.
order_contracts is treated as lots before coefficient and broker validation.
{
"platform_name": "metatrader5",
"order_action": "buy",
"ticker": "EURUSD",
"order_contracts": "0.10"
}
order_contracts is treated as percent risk of equity. This mode requires a usable Stop Loss because the EA needs stop distance to calculate position size.
{
"platform_name": "metatrader5",
"order_action": "buy",
"ticker": "EURUSD",
"order_contracts": "1.0",
"stop_loss": "100"
}
order_contracts is treated as percent of balance. This is not the same as risk-by-stop-loss mode.
{
"platform_name": "metatrader5",
"order_action": "buy",
"ticker": "EURUSD",
"order_contracts": "5.0",
"stop_loss": "100"
}
Coefficient for work with Lots multiplies the final size derived from order_contracts.
1 - keep the computed or provided size.0.5 - use half the size.2 - double the size.Always test final lot size in a demo or small-volume environment before live trading. Wrong coefficient values can create invalid volume errors or oversized positions.
Use Auto Mode unless the broker or prop firm explicitly requires another mode. MT5 retcode 10030 means the selected filling mode is not supported for that symbol.
TradingView and MT5 brokers often use different symbol names. Enter the TradingView value in TView Ticker N1 and the exact MT5 symbol in Broker Ticker N1. The same rule applies to pairs N2 through N5.
| TradingView ticker | MT5 broker symbol |
|---|---|
DE40 |
GER40 |
XAUUSD |
GOLD |
US30 |
DJ30 |
EURUSD |
EURUSD.a |
If the symbol is not found, the trade will not open. Always confirm the exact broker symbol in MT5 Market Watch.
Model A means the alert message itself sends Stop Loss, Take Profit or trailing fields.
{
"platform_name": "metatrader5",
"order_action": "sell",
"ticker": "XAUUSD",
"order_contracts": "0.05",
"sl_price": "2055.50",
"tp_price": "2038.00"
}
{
"platform_name": "metatrader5",
"order_action": "buy",
"ticker": "BTCUSDT.P",
"order_contracts": "0.10",
"stop_loss": "150",
"take_profit": "300"
}
Priority rule: if sl_price or tp_price are set and non-zero, price levels should take priority. Otherwise distance fields such as stop_loss and take_profit are used.
Model B means the EA applies internal SL/TP values from the Inputs tab.
When Use fixed SL/TP (pips) inside EA is enabled, the EA uses the internal distances for that entry instead of the alert-provided distance values. Exact behavior still depends on the selected PIP type and broker stop restrictions.
The dropdown shown as PIP type: AUTO/TRADINGVIEW/PERCENT controls how distance values are interpreted.
Wrong distance interpretation is a common cause of invalid stops and MT5 Error 4756.
Trailing can be enabled per trade with trailing_pips.
{
"platform_name": "metatrader5",
"order_action": "buy",
"ticker": "GBPUSD",
"order_contracts": "0.10",
"stop_loss": "120",
"trailing_pips": "80"
}
If trailing_pips is present, trailing is enabled for that trade. If it is absent, the EA uses Enable Trailing SL, Trailing Step in pips and Start trailing after N pips, 0 = immediate.
trail_points allows trailing stop to start only after the trade moves a specified number of pips into profit.
trail_points = 0 - trailing starts immediately after the position opens.trail_points = 50 - trailing starts only after 50 pips of profit.{
"platform_name": "metatrader5",
"ticker": "SP500",
"order_action": "buy",
"order_contracts": "4",
"trailing_pips": "20",
"trail_points": "50"
}
In this example, the trailing step is 20 pips, but trailing starts only after the trade moves 50 pips in profit.
Breakeven logic moves Stop Loss to the entry area after the trade reaches a configured profit distance.
Breakeven is useful when a strategy should remove open risk after the market moves in the intended direction.
Profit Lock is more advanced than basic breakeven. It can move Stop Loss so that a defined amount of profit is protected after the trade reaches a trigger.
In simple terms: first the trade reaches the trigger, then the EA moves SL to protect the configured profit.
The setting shown as Close size: Lots / Percent % controls whether the EA closes positions by lots or by percentage of the initial position volume.
order_contracts in a flat signal is treated as lots.order_contracts in a flat signal is treated as percent of the initial position.{
"platform_name": "metatrader5",
"ticker": "SP500",
"order_action": "flat",
"order_contracts": "25"
}
If the initial position was 4.00 lots and Close size mode is CLOSE_INITIAL_PERCENT, this command closes 25% of the initial position, which is 1.00 lot.
close_side is used with flat to close only one side where supported.
{
"platform_name": "metatrader5",
"order_action": "flat",
"ticker": "EURUSD",
"close_side": "long"
}
long or buy - close BUY-side positions.short or sell - close SELL-side positions.If close_side is used with buy, sell or modify, treat it as invalid. It belongs to close/flat logic.
modify is used to update an existing position instead of opening a new one. The position must be identified by comment or tv_order_id depending on your route.
{
"platform_name": "metatrader5",
"order_action": "modify",
"ticker": "ETHUSDT",
"comment": "TV#12345",
"stop_loss": "140",
"take_profit": "280"
}
If no matching position is found, the modification cannot be applied.
Enable increasing the lot after a losing trade activates martingale sizing. Lot increase coefficient defines the multiplier for the next step. This is a high-risk feature and should be tested carefully before live use.
Do not enable martingale just because it exists. Use it only if the trading system was designed and tested for this risk model.
The three session switches are always evaluated in UTC:
At least one selected session must be active when an entry command arrives. The enabled sessions are combined: an entry is allowed when the current UTC time is inside any enabled session and also inside the Daily Trade Window.
NY session: Winter or Summer controls the trading-day reset used by daily-loss calculations and Auto-Close:
This setting does not move the fixed New York (12:00-22:00) session row.
Daily Window Time Mode selects which clock is used to evaluate Daily Trade Window:
Daily Trade Window uses HH:MM-HH:MM. Example: 01:30-23:30. A range that crosses midnight is valid, for example 23:30-21:30.
For verification, the MT5 Experts log writes the current UTC, Broker and Local timestamps together with the selected window mode in the [SCHEDULE] record. When using Local Time, make sure the Windows/VPS clock and time zone are correct.
Example: A user who wants entries from 01:30 to 23:30 by the clock visible on the Windows desktop should select Local Time and enter 01:30-23:30. No UTC conversion is required.
Autoclose mode can close EA positions near the end of the calculated trading day or trading week. minutes before end defines how early the closing process begins. The day boundary comes from NY session: Winter or Summer.
If a signal is rejected by a session, Daily Trade Window, spread or position limit, the webhook is not necessarily broken. The EA followed the configured Inputs.
The EA can send Telegram notifications about AlgoWay connection loss and recovery.
The Inputs section also shows the required WebRequest address: https://api.telegram.org. Add it in MT5 under Tools >> Options >> Expert Advisors >> Allow WebRequest for listed URL.
This is not the same as AI Telegram signal copying. This is EA-side notification logic. For Telegram as a signal source, use: AI Telegram signal copier in AlgoWay.
Some alerts may send wrapped values such as:
{
"platform_name": "metatrader5",
"order_action": "buy",
"ticker": "EURUSD",
"order_contracts": "0.10",
"stop_loss": "stop_loss=100",
"take_profit": "take_profit=200",
"trailing_pips": "trailing_pips=80"
}
Wrapped values should be used only when the current route explicitly supports them. Clean numeric JSON values are easier to debug.
| Problem | Likely layer | Guide |
|---|---|---|
| AlgoWay does not receive the alert | TradingView webhook / JSON | Webhook Error 415 guide |
| EA does not receive commands | Webhook UUID / EA connection | MT5 setup guide |
| MT5 says trading disabled | Algo Trading permission | Error 4752 guide |
| Order is rejected | Broker execution / request parameters | Error 4756 guide |
| Wrong symbol | Symbol mapping | Common MT5 errors guide |
| SL/TP rejected | Stop level, freeze level, points/pips | Risk management guide |
| Trade opens outside the expected daily time | Daily Window Time Mode does not match the clock used by the user | Check UTC, Broker Time or Local Time, then verify Daily Trade Window |
| Entry rejected while the market is open | Max spread, session, daily window or position limit | Check the MT5 Experts log for [SPREAD], [SCHEDULE] or [LIMIT] |
When setting up a new MT5 automation route, test in layers:
00:00-23:59 and ensure at least one UTC session is enabled.The URL contains v206 because it was created during an earlier documentation cycle. The content has since been updated to match the current AlgoWayWS-MT5 EA 2.14 workflow while preserving the existing address for users who may still have older links or references.
This reference now covers the main topics required for the current MT5 automation workflow:
AlgoWayWS-MT5 EA 2.14 is the current MT5 execution component for AlgoWay automation. It receives commands from AlgoWay, executes them in MetaTrader 5, and supports trade modes, lot/risk/balance sizing, order-filling selection, SL/TP controls, trailing, breakeven, profit lock, partial close, symbol mapping, spread and position limits, UTC sessions, selectable Daily Trade Window clocks, Auto-Close, Telegram connection notifications and detailed diagnostics.
If you want to automate TradingView alerts to MetaTrader 5, start with a clean AlgoWay webhook, install the current EA, confirm the WebSocket connection, send valid JSON, test a small market order, and only then enable advanced risk and management features.