Join our fan page
- Views:
- 111
- Rating:
- Published:
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
Restart-Safe EA Template is a clean Expert Advisor skeleton that shows execution practices many EAs miss. The most common problem it solves: after MetaTrader or the VPS restarts, the EA sees the same signal again and opens a duplicate trade.
- Signals are evaluated only on closed bars and only once per bar.
- The last processed bar is stored in a terminal global variable, so a restart never repeats a signal.
- One position per symbol and magic number, recognised again after a restart.
- Spread filter, broker stop-level check and volume normalisation.
- Every decision (entry sent, signal skipped and why, broker retcode) is written to the Experts log.
The included signal is a simple moving-average cross for demonstration only: replace the GetSignal() function with your own rules. This is an educational template, not a profitable strategy. Suggested for testing: EURUSD M15.
Inputs
- Fast and slow MA periods and MA method (demo signal).
- Lot size, stop loss and take profit in points (0 = none).
- Maximum spread in points, magic number and maximum deviation.
Screenshot: Experts log in the Strategy Tester showing entries and skipped signals with their reason.

Spread ATR Monitor - current, average and max spread vs ATR
Shows the current spread next to its recent average and maximum and compares it with ATR, so you can see at a glance when trading costs are too high relative to the symbol's normal movement.
Risk Lot Panel - position size by risk and stop distance
On-chart panel that calculates the lot size for a given risk (% of balance, % of equity or fixed money) and stop-loss distance, using the broker's tick size and tick value. Works on forex, metals, indices and crypto.
Prop-firm Guard - daily loss and max drawdown protection for challenge accounts
Watches the whole account and closes everything before the daily loss or max drawdown limit is breached, then keeps the account flat until the block ends. Does not trade.
Leverage Monitor – Real Leverage, Margin Tiers, Swap, Commission and Spread
See the real leverage of every Market Watch symbol, including floating margin tiers, with swap, commission and live spread in one panel.