Gold CASTLE MT5 — Input Parameters Guide

Gold CASTLE MT5 — Input Parameters Guide

18 July 2026, 13:45
Henny Kurniawati
0
22
A detailed reference for every input of the Gold CASTLE MT5 EA, using the labels shown in the terminal's Inputs tab. Defaults listed are the values shipped with the current build.

General Settings

Expert Magic Number (default: 88888888) — A unique ID that tags every order this EA places, so its trades are never confused with manual trades or other EAs on the same symbol. Give each chart running the EA its own number if you run more than one.

Default Order Comment (default: GCM) — Free-text comment attached to every order. Purely a label; the EA also appends its own layer tags ( -L long layer, -S short layer, -M micro) after this text.

Signal Timeframe (default: H1) — The timeframe the EA reads candles from to detect the impulse/breakout and swing levels. Entries and swing highs/lows are calculated on this timeframe.

Maximum Pending Orders (one side, 0 = off) (default: 6) — Hard cap on how many pending orders the EA may hold on a single side (buy or sell). 0 = off (no cap). Prevents the breakout stack from growing without limit.

Warm-up: bars to observe after attach before trading (0 = off) (default: 1) — Number of new signal-timeframe bars the EA waits and observes after being attached before it is allowed to place its first order. 0 = off. Avoids trading on a half-formed picture right after start-up.


Lot Size Settings

Lot Size Method (default: Fixed Lot Size) — Chooses how position size is calculated. Fixed Lot Size uses a constant lot for every order; Lot Per Balance scales the lot up in steps as the account grows (see the two settings below). Pick one; the other sizing inputs only apply to their matching mode.

Fixed Lot Size (default: 0.01) — The base lot used for every order in Fixed Lot Size mode, and the starting unit that gets multiplied in Lot Per Balance mode. All volumes are normalized to the symbol's min/max/step.

Balance Step For Lot Increase (default: 500.0) — Used only in Lot Per Balance mode. For every full multiple of this amount in the account, the base lot is multiplied by one step (e.g. at 500 and 0.01 base, a 1,500 account trades ≈ 0.03). Larger values grow lots more slowly.

Calculate Lot By Equity (default: false) — In Lot Per Balance mode, decides the figure used for the step calculation. true uses live equity (reacts to floating P/L); false uses account balance (steadier).


Stoploss Settings

Order Stop Loss (points) (default: 40) — Stop-loss distance in points applied to each filled position, measured from the entry price. If the distance is smaller than the broker's minimum stop/freeze level, the EA auto-adjusts it outward. With virtual SL/TP on, this distance is managed internally instead of being sent to the broker.


Trailing Stop Settings

Use Trailing Stop (default: true) — Master on/off switch for the trailing stop. When off, none of the trailing settings below apply and exits rely on the fixed stop, protections, or Friday/time closes.

Trailing Start Profit (points) (default: 15) — Profit in points a position must reach before the trailing stop activates. The stop only begins following price once this cushion exists.

Trailing Stop Distance (points) (default: 5) — How far behind price the trailing stop is kept once active, in points. Smaller values lock profit tighter but are stopped out sooner.

Minimum Trailing Step (points) (default: 2.5) — The smallest move, in points, before the trailing stop is shifted again. Prevents constant tiny modifications on every tick.


Virtual (Hidden) SL/TP Settings

Use virtual/hidden SL & TP (NOT sent to broker) (default: false) — When on, stop-loss and take-profit are kept internally by the EA and closed in code rather than being placed with the broker. Useful to hide levels from the broker/ECN, but the terminal must stay running for them to work.

Virtual Take Profit (points, 0 = no TP) (default: 0) — Take-profit distance in points used only in virtual mode. 0 = no TP (the position runs on trailing/stop only).

Persist virtual levels in terminal global vars (restart-safe) (default: true) — Saves the virtual SL/TP levels in terminal global variables so they survive a terminal restart or EA reload instead of being lost.

Draw virtual SL/TP as dashed lines on the chart (default: true) — Draws the hidden SL/TP as dashed lines so you can see the levels the EA is tracking. Visual only.


Account Protection Settings

Daily Profit Target Type (default: Account Percent) — Whether the daily profit target is read as a Money Amount (currency) or an Account Percent of the day's starting balance.

Daily Profit Target Value (0 = off) (default: 0.0) — The daily profit goal, interpreted by the type above. Once reached, the EA closes everything and stops trading for the rest of the server day. 0 = off.

Daily Loss Limit Type (default: Account Percent) — Whether the daily loss limit is a Money Amount or an Account Percent of the day's starting balance.

Daily Loss Limit Value (0 = off) (default: 0.0) — The daily loss cap. When the day's loss reaches it, the EA closes everything and halts for the rest of the day. 0 = off.

Floating Drawdown Limit Type (default: Account Percent) — Whether the floating-drawdown limit is a Money Amount or an Account Percent of balance.

Floating Drawdown Limit Value (0 = off) (default: 0.0) — Maximum unrealized (floating) drawdown allowed while positions are open. If breached, the EA closes everything — but, unlike the daily limits, trading may resume the same day. 0 = off.


Trading Time Settings

All times are server time. Set a value to 00:00 to disable that individual rule.

Daily Trading Start Time (server, 00:00 = off) (default: 01:15) — Time of day the EA is allowed to start placing new orders.

Daily Trading Pause Time (server, 00:00 = off) (default: 20:00) — Time of day the EA stops opening new orders for the day.

Daily Pending Order Close Time (server, 00:00 = off) (default: 20:45) — Time of day all remaining pending (unfilled) orders are deleted, clearing the book before the session ends.

Friday Closing Time (server, 00:00 = off) (default: 18:00) — Time on Friday at which the EA acts on the Friday-close rule below.

Close Open Positions On Friday (default: true) — When on, open positions are closed at the Friday closing time to avoid weekend gap risk (pending orders are cleared as part of the same routine).


Margin Check Settings

Check Free Margin Before Placing Pending (default: true) — Verifies that free margin can cover the order — and all currently placed stop pendings if they were to fill together — before adding a new one, preventing "not enough money" rejections when several breakout stops trigger at once.

Margin Buffer (% of equity kept free) (default: 20.0) — A cushion of equity, as a percentage, the EA keeps unused when doing the margin projection above. Higher values are more conservative and place fewer orders.


Market-Open Check Settings

Check Market Is Open (orders/trailing/close) (default: true) — Before placing orders, trailing, or closing, the EA confirms the symbol is tradeable: trade mode allowed, AutoTrading on, inside the symbol's session, and receiving fresh quotes. Blocks activity during closed/illiquid periods.

Max age of last quote to treat market live (sec) (default: 30) — How stale the last quote may be, in seconds, before the EA treats the feed as frozen and holds off. Guards against acting on a stuck price at the open.

Delete Pending Orders When EA Is Removed (default: true) — When the EA is removed from the chart (or terminal shutdown), its pending orders are deleted so no orphan stops are left behind.


NFP Filter

Enable NFP Filter (default: true) — Master switch for the Non-Farm Payroll news filter. When on, the EA avoids trading around the monthly NFP release.

Close Open Trades On NFP Window (default: true) — When on, open positions are closed as the NFP block window begins, so nothing is exposed through the release.

Close Pending Orders On NFP Window (default: true) — When on, pending orders are removed as the NFP block window begins, so a stop isn't triggered by the news spike.

NFP Minutes Before (default: 100) — How many minutes before the NFP release the block window opens (trading stops).

NFP Minutes After (default: 60) — How many minutes after the NFP release the block window stays closed before trading may resume.


Cooldown after LOSS

Enable loss cooldown (default: true) — Master switch for pausing new entries after losing trades, so the EA doesn't immediately re-enter a bad patch.

Cooldown after a losing trade (sec) (default: 120) — How long, in seconds, the EA pauses new entries after a single losing trade closes.

Consecutive losses before escalation (default: 3) — The number of losses in a row that triggers the longer "loss streak" cooldown below.

Cooldown after a loss streak (sec) (default: 600) — The longer pause, in seconds, applied once the consecutive-loss count above is reached.

Loss threshold USD (0 = any loss counts) (default: 0.0) — Minimum loss in USD for a closed trade to count toward the cooldown logic. 0 = any loss counts, no matter how small.


PROTECTION GUARD: spread spike & slippage

Guard: pause on a broker spread SPIKE (default: true) — Master switch for the spread guard. When on, the EA pauses new signals whenever the spread spikes, keeping entries out of poor conditions.

Absolute floor vs relative spike (default: Spike vs learned typical spread) — Chooses how the trip level is decided. Fixed floor (pips) trips at a set pip value; Spike vs learned typical spread trips when spread rises to the learned typical spread multiplied by the factor below (auto-adapts to the broker).

Spread trip floor (pips) (default: 50) — The absolute spread level, in pips, that trips the guard. In relative mode this also acts as a minimum floor. (~$5.0 on XAUUSD.)

Relative mode: trip at typical spread × this (default: 3.0) — In relative mode, the multiple of the learned typical spread at which the guard trips (e.g. 3.0 = trip when spread is 3× normal).

Typical spread (0 = auto-learn live) (default: 0) — Lets you pin the "typical" spread manually, in pips. 0 = auto-learn from live quotes (recommended for live; set a value for reproducible backtests).

Guard: pause on excessive fill / SL-close slippage (default: true) — Master switch for the slippage guard. When on, the EA pauses after abnormal execution or stop-close slippage.

Trip cooldown if entry slippage > this (pips) (default: 50) — Entry-fill slippage, in pips, above which the guard trips a cooldown. (~$3.0 on XAUUSD.)

Trip cooldown if SL-close slippage > this (pips) (default: 50) — Stop-loss close slippage, in pips, above which the guard trips a cooldown. (~$3.0 on XAUUSD.)

Cooldown after a guard trips (seconds) (default: 900) — How long, in seconds, new signals stay paused after either guard trips.


Dashboard Settings

Show on-chart info panel (dashboard on/off) (default: true) — Shows or hides the on-chart status panel. Visual only; it does not affect trading.

Corner: 0=TL 1=TR 2=BL 3=BR (default: 0) — Which chart corner the panel anchors to: 0 top-left, 1 top-right, 2 bottom-left, 3 bottom-right.

Panel X offset (px) (default: 12) — Horizontal distance of the panel from the chosen corner, in pixels.

Panel Y offset (px) (default: 24) — Vertical distance of the panel from the chosen corner, in pixels.

Panel font size (default: 9) — Font size of the panel text.

Panel text color (default: Gainsboro) — Color of the panel text. Cosmetic only.

Panel background color (default: dark grey, RGB 30,30,30) — Background color of the panel. Cosmetic only.


Strategy in one glance

Gold CASTLE places breakout stop orders at the latest swing high/low on the signal timeframe, in the direction of the most recent completed candle. Orders are organized into a long "main" layer plus an optional short-lived layer, with optional smaller "micro" swing orders. There is no fixed take-profit by default — positions are managed out by the trailing stop, the fixed stop-loss, the Friday/time closes, and the account-protection limits. On top of that sit several safety layers that are always working in the background.

Built-in safeguards (automatic behaviors)

These shape how the inputs play out and are active whenever their toggles are on:

  • Broker level auto-adjust — pending prices and stop-losses that sit closer than the broker's stop/freeze level are pushed out automatically, avoiding "invalid stops" rejections.
  • Margin projection — the margin check assumes every currently placed breakout stop could fill at once, so a wave of triggers can't overload the account.
  • Market-open / fresh-quote guard — orders, trailing, and closes are held when the symbol is out of session or the feed is stale.
  • Spread & slippage guards — a spread spike or abnormal fill/close slippage pauses new signals for a cooldown.
  • Loss cooldowns — a single loss, or a streak of losses, pauses new entries so the EA can't over-trade a rough patch.
  • NFP window — around the monthly Non-Farm Payroll release the EA can stay out and optionally flatten open trades and pendings.
  • Daily & floating protection — daily profit target, daily loss limit, and floating-drawdown limit each close everything and (for the daily ones) halt trading for the day.

This guide documents the inputs exposed in the MetaTrader 5 Inputs tab. Defaults are the shipped values and can be tuned to your account size, broker conditions, and risk tolerance. Always test on a demo account before going live.