Trendshield
- Experts
-
Alex Amuyunzu Raymond
I’m an experienced MQL5 developer and software engineer specializing in building robust, high-performance algorithmic trading systems for MetaTrader 5. My work goes beyond standard EA development — I design intelligent, scalable solutions that combine market logic, automation, and external - Versione: 1.0
- Attivazioni: 5
TrendShield — EMA Crossover Expert Advisor with Built-In Prop Firm Risk Governor
TrendShield is a fully automated trend-following Expert Advisor built specifically for traders operating funded and proprietary trading accounts, with particular attention paid to strict daily drawdown rules such as those enforced by FundedNext and similar prop firms. Rather than being a generic crossover script, TrendShield was engineered around one core principle: a strategy is only as good as the risk framework wrapped around it. Every trade the EA places is governed by a layered protection system designed to keep an account inside its risk limits even during volatile sessions on index instruments like NAS100, US30 and SP500.
At its core, TrendShield trades a classic and transparent Fast/Slow EMA crossover, with default periods of 9 and 50, evaluated on a configurable signal timeframe. A bullish crossover opens a long position, a bearish crossover opens a short position, and an optional setting allows the EA to immediately flatten an existing position the moment an opposite crossover appears, rather than waiting for stop loss or take profit to be hit. This gives traders the choice between a strict mechanical exit and a more reactive trend-following behavior, depending on their own risk appetite.
Position sizing is handled dynamically. Rather than using a fixed lot size, TrendShield calculates position size from the account balance, the configured risk percentage per trade, and the real tick value and tick size of the traded symbol. This means lot sizing remains mathematically correct across brokers and instruments with different contract specifications, which is essential when trading indices where tick value can vary significantly from one broker to another. Stop loss and take profit are always submitted directly with the market order — there are no mental stops or hidden exit logic, which matters for prop firm rule compliance and for full transparency in trade history.
Trade management continues after entry through two optional modules: a breakeven function that moves the stop loss to entry once a configurable profit threshold in points is reached, and a trailing stop function that steps the stop loss forward as price moves favorably, with independently configurable trailing distance and trailing step.
The feature that separates TrendShield from typical crossover EAs is its daily drawdown governor. The EA continuously monitors floating and realized account equity against the day's starting equity. If the configured maximum daily loss percentage is reached — including floating losses on open positions, not just closed trades — TrendShield immediately closes every position it manages, deletes any pending orders it placed, and disables further trading for the remainder of the trading day. This state is written to persistent global variables tied to the EA's unique magic number, meaning the daily protection status survives a terminal restart, a power outage, or an accidental EA removal and reattachment. The daily counter resets cleanly at the start of each new trading day without manual intervention.
TrendShield also respects a configurable maximum number of simultaneous open trades, a maximum allowable spread in points to avoid entries during illiquid or news-driven spread spikes, and a configurable trading window based on broker/server time so that trading only occurs during the hours a trader has chosen to permit. A dedicated news filter connects to the MetaTrader 5 economic calendar and automatically detects high-impact, three-star events, blocking new entries for a configurable number of minutes before and after each event.
On the technical side, every order placed by TrendShield is tagged with a unique magic number, ensuring the EA never interferes with trades placed manually or by any other Expert Advisor running on the same account. The EA supports broker-specific symbol suffixes such as NAS100.sb or USTEC, correctly reads each symbol's lot step, minimum and maximum volume, tick value and tick size, and performs a margin check before submitting any order to avoid failed trades due to insufficient free margin. Trade execution includes proper handling of requotes, slippage tolerance, and invalid stop errors, with all failures logged for review.
Finally, TrendShield includes a redesigned on-chart dashboard that goes beyond a simple text readout. Presented as a dark, professionally styled panel, it displays live trading status, current trend bias, account equity and balance, daily loss consumed against the configured limit, the equity floor at which protection triggers, open trade count against the configured maximum, live spread against the configured cap, the current trading window state, and the current news filter state — giving the trader an immediate, color-coded view of exactly why the EA is or is not trading at any given moment.
TrendShield is built for traders who want a disciplined, rule-based approach to index trading that respects the operational limits imposed by proprietary trading firms, without sacrificing the flexibility to tune the underlying strategy to their own preferences.
