DEMO Version limits: EA will close trades after 5 minutes of opening and EA will also terminate itself after 10 minutes (you may reload the EA and continue testing). The full version has no such limits.

NB: You need a TradingView paid version to create webhook alerts (Free version does not have that feature)

Installation Guide

1. Copy-paste the provided EA file into your MetaTrader → Experts folder.

2. Enable WebRequest in MT4/MT5:
Go to Tools → Options → Expert Advisors → Allow WebRequest for below URLs:

  • http://YOUR_VPS_IP (use the IP given in the mail you received)
  • https://frzserver.com

3. Attach the EA to any single chart (it executes across all symbols).
⚠️ You may need to get your account licensed.

4. In Inputs, paste your API key provided by us (use the IP given in your license email).

5. On TradingView, create alerts with Webhook URL: http://YOUR_VPS_IP/webhook

6. Use JSON alert formats (examples below).

FAQ

  • Is symbol always required?
    For open orders yes. For close, omit it to close all trades or include it for a specific symbol.
  • Is price required?
    Only for pending orders (*_limit, *_stop). Market orders ignore price.
  • Is lot size required?
    Yes, however, if you omit the lot size in the alert, it will take the lot size given under the EA settings.
  • Can I use sl_pips/tp_pips or sl/tp?
    Both styles are accepted. They represent pips.
  • Can TP/SL come from my indicator values?
    Yes. Reference them in your TradingView alert body. Refer to examples given later in this document.

Minimum Required Fields (Market Order)

  • apiKey – your unique api key given by us
  • symbol – e.g., EURUSD, BTCUSD. (Tip: use {{ticker}}in TradingView for automatic symbol).

Supported Parameters

  • price → required for pending, ignored for market.
  • action – one of: buy, sell, buy_limit, sell_limit, buy_stop, sell_stop (if “action” is omitted, then it will be market order by default)
  • Trade management: close, close_all, close_symbol, cancel_pending_all, cancel_pending_symbol 
  • lot_size → If used, it will override the lot size given under EA settings.
  • sl  → stop loss in pips.
  • tp → take profit in pips.
  • sl_price → absolute SL price.
  • tp_price → absolute TP price.
  • tp_multiplier → TP = SL × multiplier.
  • plot_0, plot_1 → use values from indicator plots.
  • ticker → replaced with the chart’s symbol.
  • strategy.order.action → Automatically becomes “buy” or “sell” depending on your strategy signal.

EA Inputs

  • Your API Key: Your unique API key. This is a crucial security measure that authenticates your requests to the server. You will be given an API Key when you buy the full version. Please paste it here.
  • Server URL: The URL of the server that the EA will poll for trade signals. This should be provided to you and usually does not need to be changed unless otherwise advised.
  • Default Lot Size: The default lot size for all trades. This value is used if you do not specify a lot_size in your TradingView alert’s JSON payload. For example, if you set this to 0.10, all trades will be for 0.10 lots unless a different value is specified in your alert.
  • Slippage (Points): The maximum allowable slippage, measured in points, for market orders. If the price moves by more than this number of points between the time the EA sends the order and the time it is filled, the trade will be rejected.
  • Update Frequency: The frequency (in seconds) at which the EA checks the server for new trade signals. A value of 1 means it will check every second. We recommend you use 5 unless you are scalping on M1. 
  • Magic Number: A unique number used to identify trades placed by this specific EA. This allows the EA to differentiate its own trades from others and is essential for managing positions correctly. It is a best practice to use a unique magic number for each EA you run.

Example Alerts

1) Market Orders

1.1 Market Buy (simple) (lot size handled at EA input)

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "{{ticker}}",
  "action": "buy"
}

1.2 Market Buy with lot size

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "EURUSD",
  "action": "buy",
  "lot_size": 0.05
}

1.3 Market Sell with SL/TP in pips

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "EURUSD",
  "action": "sell",
  "sl": 20,
  "tp": 40
}

1.4 Market Buy with Absolute SL/TP

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "EURUSD",
  "action": "buy",
  "sl_price": 1.0820,
  "tp_price": 1.0880
}

1.5 Market Buy with Multiplier (TP = SL × 3)

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "GBPUSD",
  "action": "buy",
  "sl": 25,
  "tp_multiplier": 3
}

2) Pending Orders

2.1 Buy Limit

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "EURUSD",
  "action": "buy_limit",
  "price": 1.0950,
  "sl": 20,
  "tp": 40
}

2.2 Sell Limit

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "XAUUSD",
  "action": "sell_limit",
  "price": 2375.50,
  "sl": 250,
  "tp": 500
}

2.3 Buy Stop

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "GBPUSD",
  "action": "buy_stop",
  "price": 1.2800,
  "sl": 30,
  "tp": 60
}

2.4 Sell Stop

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "BTCUSD",
  "action": "sell_stop",
  "price": 118000,
  "sl": 400,
  "tp": 800
}

3) Trade Management

3.1 Close All Trades

{
  "apiKey": "YOUR_API_KEY",
  "action": "close_all"
}

3.2 Close Trades for One Symbol

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "EURUSD",
  "action": "close_symbol"
}

3.3 Cancel All Pending Orders

{
  "apiKey": "YOUR_API_KEY",
  "action": "cancel_pending_all"
}

3.4 Cancel Pending Orders for One Symbol

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "GBPUSD",
  "action": "cancel_pending_symbol"
}

4) Pulling SL/TP from Strategy/Indicator

With TradingView alerts, you can dynamically inject stop-loss (SL) and take-profit (TP) values calculated by your strategy or indicator. This avoids hard-coding pip values or fixed prices in the alert JSON.

Example A – Using pip distances from strategy variables

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "{{ticker}}",
  "action": "{{strategy.order.action}}",
  "sl": {{plot_0}},
  "tp": {{plot_1}}
}

Example B – Using absolute TP/SL prices  from strategy variables

{
  "apiKey": "YOUR_API_KEY",
  "symbol": "{{ticker}}",
  "action": "{{strategy.order.action}}",
  "sl_price": {{plot_0}},
  "tp_price": {{plot_1}}
}
  • {{ticker}} → Replaced with the chart’s symbol (e.g., EURUSD).
  • {{strategy.order.action}} → Automatically becomes "buy" or "sell" depending on your strategy signal. (PS: only a strategy can generate the {{strategy.order.action}} placeholder not indicators).
  • {{plot_0}} → Injects the first plotted line from your indicator (e.g., a stop-loss line).
  • {{plot_1}} → Injects the second plotted line (e.g., a take-profit target).
  • Use sl / tp if your Pine Script calculates and exposes pip values.
  • Use sl_price / tp_price if your Pine Script outputs absolute prices.

Pine Script Example for Dynamic SL/TP

This is a simple TradingView strategy:

  • Entry Long (Buy): when EMA(10) crosses above EMA(20).
  • Entry Short (Sell): when EMA(10) crosses below EMA(20).
  • Stop-loss (SL): lowest (for long) or highest (for short) of the last 5 candles.
  • Take-profit (TP): fixed multiple of SL distance (2× in this example).

//@version=5
strategy(“EMA Cross with SL/TP”, overlay=true, margin_long=100, margin_short=100)

// ── Inputs
emaFast = ta.ema(close, 10)
emaSlow = ta.ema(close, 20)

// ── Cross conditions
longCond = ta.crossover(emaFast, emaSlow)
shortCond = ta.crossunder(emaFast, emaSlow)

// ── Stop levels
longSL = ta.lowest(low, 5)
shortSL = ta.highest(high, 5)

// ── Entry logic
if (longCond)
risk = close – longSL
strategy.entry(“Long”, strategy.long)
strategy.exit(“TP/SL”, “Long”, stop=longSL, limit=close + risk * 2)

if (shortCond)
risk = shortSL – close
strategy.entry(“Short”, strategy.short)
strategy.exit(“TP/SL”, “Short”, stop=shortSL, limit=close – risk * 2)

// ── Plotting
plot(emaFast, color=color.orange)
plot(emaSlow, color=color.blue)

Modified Strategy for MT4 Bridge

Now we adapt it so the strategy sends alerts with:

  • ticker (symbol)
  • action (buy/sell)
  • SL price (absolute)
  • TP price (absolute)

//@version=5
strategy(“EMA Cross with SL/TP Alerts”, overlay=true, margin_long=100, margin_short=100)

// ── Inputs
emaFast = ta.ema(close, 10)
emaSlow = ta.ema(close, 20)

// ── Cross conditions
longCond = ta.crossover(emaFast, emaSlow)
shortCond = ta.crossunder(emaFast, emaSlow)

// ── Stop levels
longSL = ta.lowest(low, 5)
shortSL = ta.highest(high, 5)

// ── Alert values (absolute price levels)
longTP = close + (close – longSL) * 2
shortTP = close – (shortSL – close) * 2

// ── Entry logic
if (longCond)
strategy.entry(“Long”, strategy.long)
alert(‘{ “apiKey”: “YOUR_API_KEY”, “symbol”: “{{ticker}}”, “action”: “buy”, “sl_price”: ‘ + str.tostring(longSL) + ‘, “tp_price”: ‘ + str.tostring(longTP) + ‘ }’)

if (shortCond)
strategy.entry(“Short”, strategy.short)
alert(‘{ “apiKey”: “YOUR_API_KEY”, “symbol”: “{{ticker}}”, “action”: “sell”, “sl_price”: ‘ + str.tostring(shortSL) + ‘, “tp_price”: ‘ + str.tostring(shortTP) + ‘ }’)

// ── Plotting
plot(emaFast, color=color.orange)
plot(emaSlow, color=color.blue)

Not Yet Supported

  • Trailing stops
  • Breakeven rules
  • Modify existing trades
  • Partial close
  • Close by magic no.

Common Errors & Fixes

  • 422 Error – “Field required: apiKey” → Add "apiKey":"YOUR_API_KEY".
  • OrderSend 130 (MT4) → invalid SL/TP distance. Use bigger SL/TP.
  • Repeating Webrequest Error: 5203 → This usually happens when server is busy. But EA will connect next time. You may reduce EA polling period to higher level such as every 10 seconds or more.
0
    0
    Your Cart
    Your cart is emptyReturn to Shop