FJ Universe ADX Regime
- Experts
-
Frantisek Juris
Hello!
Thank you for visiting my profile - I truly appreciate it!
I'm a full-time traveler who previously worked as an automation specialist in the field of software testing and development. I’ve worked with companies like Vodafone, NCR, and Global Payments in Prague, Czech Republic. - Version: 1.0
- Activations: 5
Overview
FJUNIVERSE ADX REGIME EA is a fully automated Expert Advisor for MetaTrader 5 that uses the Average Directional Index (ADX) and Directional Movement indicators (+DI / -DI) as its core signal engine. The EA detects the current market regime, whether trending, ranging, or transitional, and adapts its trading logic accordingly. Every trade entry requires a confirmed +DI / -DI crossover between bar[1] and bar[0], combined with configurable ADX strength and momentum filters that must all pass simultaneously. This approach eliminates false entries caused by choppy, directionless price action and ensures trades are only placed when the market shows genuine directional conviction.
The EA includes seven trading strategy modes featuring the book-accurate DYNAMIC regime switching engine, a Dollar Cost Averaging system, an Auto Lot Recovery calculator, a live on-chart monitoring panel, and real-time Discord and Telegram notifications covering every trade event. This version introduces the DYNAMIC strategy mode based on J. Welles Wilder's ADX regime framework, two SMART entry modes for intelligent position averaging, a choice between ON_TICK and ON_CANDLE_CLOSE execution timing, a top-right monitoring table showing live entry requirement pass or fail status, and a complete Discord and Telegram notification system with queued delivery, duplicate detection, and automatic capture of broker-side take-profit and stop-loss closures.
Signal Engine - ADX and DI Cross Conditions
Every trade entry is gated by the FJU ADX Filter. The following conditions are available and can each be enabled or disabled independently:
- ADX trending filter: enter only when ADX value is above the configured trend level (default 25), confirming a strong directional market
- ADX rising filter: enter only when the current ADX bar is higher than the previous bar, confirming momentum is accelerating rather than fading
- +DI cross above -DI: the primary LONG trigger, fires when the positive directional indicator crosses above the negative directional indicator between bar[1] and bar[0]
- -DI cross above +DI: the primary SHORT trigger, fires when the negative directional indicator crosses above the positive directional indicator between bar[1] and bar[0]
- Trade direction filter: restrict entries to LONG_ONLY, SHORT_ONLY, or NO_FILTER (both directions allowed)
The ADX indicator period, trend level threshold, and range level threshold are all configurable. All signals are confirmed on bar close to avoid false intra-bar crossovers.
ADX Regime Framework
The EA implements the ADX regime classification system developed by J. Welles Wilder. The ADX value divides the market into three zones:
- ADX above 25 (Trending): the market is moving with conviction in one direction. Trend-following strategies work here. Breakout trading works here. Mean reversion fails.
- ADX below 20 (Ranging): the market is bouncing between support and resistance. Momentum means nothing. Mean reversion works here. Trend following fails.
- ADX between 20 and 25 (Gray Zone): transition territory. The market is waking up or falling asleep. The EA handles this zone by reducing lot size via the gray zone lot percentage setting, keeping your take-profit and stop-loss exactly as configured.
The DYNAMIC strategy mode implements this framework automatically, switching between trend-following and mean-reversion logic based on the live ADX value every tick.
Trading Strategies
| Strategy | Description |
|---|---|
| CLASSIC | Opens one trade per DI crossover signal. Long when +DI crosses above -DI. Short when -DI crosses above +DI. Only one position open at a time per direction. |
| TREND_FOLLOW | Same DI crossover logic as CLASSIC but additionally requires ADX to be rising (current bar higher than previous). Only opens trades when trend momentum is accelerating. Most selective mode. |
| REVERSAL | Counter-trend mean reversion mode. Opens a long when -DI crosses above +DI (fade the shorts). Opens a short when +DI crosses above -DI (fade the longs). Designed for ranging markets. |
| BOTH_SIDES | No directional filter. Accepts any DI crossover signal in either direction. Can hold long and short positions simultaneously on the same symbol. |
| DYNAMIC | Automatically switches strategy based on the live ADX value. When ADX is above the trend level (default 25), the EA uses TREND_FOLLOW logic requiring rising momentum. When ADX is below the range level (default 20), the EA switches to REVERSAL logic for mean reversion. In the gray zone between 20 and 25, the EA trades cautiously with a reduced lot size via the gray zone lot percentage setting. Take-profit and stop-loss are always applied exactly as configured. |
| CLASSIC_EXTREME_SMART | Opens the first trade using standard CLASSIC DI crossover logic. For subsequent entries (when DCA or multiple trades are enabled), only opens a new position when a valid DI cross signal fires AND the current entry price is better than the average open price of all existing positions in that direction. For longs, the ask must be below the current DCA average. For shorts, the bid must be above the current DCA average. Prevents averaging into worse levels. |
| CLASSIC_EXTREME_SMART_PLUS | Same smart entry logic as CLASSIC_EXTREME_SMART but compares the current price against the most recent individual entry price instead of the DCA average. For longs, the ask must be below the last long entry price. For shorts, the bid must be above the last short entry price. A stricter filter than CLASSIC_EXTREME_SMART that ensures every new position in the basket is at a genuinely better level than the previous one. |
Take-Profit and Stop-Loss
Take-profit and stop-loss are calculated as a percentage of the entry price. This universal approach works identically on all instruments regardless of price scale, pip value, or decimal places. No manual recalculation is needed when switching between Forex, Metals, Crypto, or Indices. The exact percentages you configure are applied to every position, consistent with other FJUNIVERSE EAs. Both TP and SL can be independently enabled or disabled. Close on reversal signal is also available as an independent exit method, closing a LONG when a SHORT signal fires and vice versa.
Lot Sizing
Four sizing formats are available:
- LOT: direct lot size input, the simplest option
- CURRENCY_AMOUNT: fixed amount in the account currency. The EA calculates the lot size so that a full price move to zero would cost the configured amount
- PERCENT_OF_BALANCE: lot size is calculated so that a full price move to zero would cost the configured percentage of account balance. In practice this produces a conservative position, so a typical TP or SL hit represents only a fraction of that percentage
- PERCENT_OF_EQUITY: same calculation as PERCENT_OF_BALANCE but uses live equity instead of balance, so the lot size adjusts dynamically as equity changes
If the calculated lot size falls outside broker limits, the EA logs a warning to Discord with the minimum and maximum recommended cost values so you can adjust the setting. Because the formula is based on full-position-value risk rather than TP distance, the configured amount behaves as a hard ceiling on potential loss.
Dollar Cost Averaging
When DCA is enabled, the EA opens additional positions as the market moves against the initial trade. The average entry price is recalculated across all open positions after each DCA level. TP and SL levels shift dynamically to reflect the new averaged cost, so the entire basket only needs to recover to the average price plus TP percentage rather than return to the original entry. A stop-loss can optionally remain inactive until the first DCA position is opened, giving the initial entry more room before drawdown protection activates.
Auto Lot Recovery
When previous trades have resulted in a net loss, the Auto Lot Recovery system calculates a larger lot size for the next trade to recover the deficit. Two modes are available:
- From past trades by magic number: reads the actual closed profit and loss of the last N trades belonging to this EA and calculates the exact lot needed to recover the total loss plus an additional percentage buffer
- From equity and balance drawdown: monitors live equity against balance and sizes the next trade to recover the equity gap
A margin safety check ensures the recovery lot does not exceed 90 percent of available free margin. If it does, the EA scales the lot down automatically or falls back to the base lot size and logs a warning.
Equity Target Auto-Exit
A specific equity value can be configured. When the account reaches that level, the EA closes all open positions immediately. This is useful for running profit targets on challenge accounts, managed accounts, or prop firm evaluations.
Last Cycle Mode
When the last cycle setting is enabled, the EA stops opening new positions but continues managing existing trades through their TP, SL, DCA, and reversal-close logic. This is useful for winding down a strategy before disabling the EA or before a news event where you want to exit existing exposure without adding new risk.
Execution Timing
The EA supports two execution modes controlled by the executeOn parameter. ON_TICK evaluates the strategy on every price change, giving the fastest possible reaction to new crossover signals but consuming more CPU. ON_CANDLE_CLOSE evaluates only when a new bar opens, which is the traditional approach, uses less CPU, and trades on confirmed bar-close signals. ON_CANDLE_CLOSE is preferred for higher timeframes and for users running multiple EAs on the same terminal. ON_TICK is preferred for lower timeframes and scalping or when immediate entries are needed.
On-Chart Monitoring Table
A live monitoring panel is drawn in the top-right corner of the chart showing every entry requirement with a pass or fail color indicator. Updated every tick or every candle close (matching the execution timing setting), the table displays the currently selected strategy, the effective strategy DYNAMIC has resolved to, the ADX trending filter status, the ADX rising filter status, the +DI and -DI cross trigger status, the current ADX value (color-coded green for trending, orange for ranging, yellow for gray zone), the current +DI and -DI values, and the count of open long and short positions. This lets you see at a glance why the EA is or is not entering, without opening the Experts log.
Discord and Telegram Notifications
The EA sends real-time notifications for every trade event: EA startup, EA shutdown, trade entry, trade exit including broker-side TP and SL closures, equity target reached, and error conditions. Messages are queued and sent at 3-second intervals to avoid API flooding, with built-in duplicate detection to prevent the same event being sent twice.
Discord notifications use rich color-coded embeds (green for profit, red for loss, orange for warnings, gray for system events) and can be routed to up to three separate webhook destinations: a monitor channel, a custom log channel, and a results summary channel. Telegram notifications use HTML formatting with proper UTF-8 encoding and send to both a shared FJUNIVERSE channel and an optional user-configured channel. Custom branding links (brand name + URL) can be appended to every notification.
Closed trades are captured by an OnTrade event handler that monitors the trade history database, so broker-side TP and SL hits, manual closes, and EA-initiated closes are all reported identically. You never miss a closure.
Input Parameters
ALGO Conditions
| Parameter | Default | Description |
|---|---|---|
| andIsADXTrending | true | Require ADX to be above the trend level before opening a trade |
| andIsADXRising | false | Require ADX to be rising (current bar higher than previous) |
| andIsDIPlusCross | true | Require +DI / -DI crossover for LONG signals |
| andIsDIMinusCross | true | Require -DI / +DI crossover for SHORT signals |
| tradingStrategyMode | DYNAMIC | One of seven strategy modes: CLASSIC, TREND_FOLLOW, REVERSAL, BOTH_SIDES, DYNAMIC, CLASSIC_EXTREME_SMART, CLASSIC_EXTREME_SMART_PLUS |
| openOnly | NO_FILTER | Direction filter: NO_FILTER, LONG_ONLY, SHORT_ONLY |
| executeOn | ON_TICK | When to evaluate strategy logic: ON_TICK for every price change, ON_CANDLE_CLOSE for bar close only (lower CPU, confirmed signals) |
ADX Indicator Settings
| Parameter | Default | Description |
|---|---|---|
| adxPeriod | 14 | ADX indicator lookback period |
| adxTrendLevel | 25.0 | ADX value above which the market is classified as trending |
| adxRangeLevel | 20.0 | ADX value below which the market is classified as ranging |
| showIndicatorLogs | false | Print ADX, +DI, -DI, and signal values to the Experts log every tick |
| grayZoneLotPercent | 50.0 | Percentage of normal lot size used in the ADX gray zone (20-25). Only applies in DYNAMIC mode. Set to 0 to block trading in the gray zone entirely. Take-profit and stop-loss are not modified. |
Strategy Settings
| Parameter | Default | Description |
|---|---|---|
| useTP | true | Enable automatic take-profit placement |
| ADXR_TP_PERC | 2.0 | Take-profit distance as percentage of entry price |
| useSL | true | Enable automatic stop-loss placement |
| ADXR_SL_PERC | 1.0 | Stop-loss distance as percentage of entry price |
| closeOnReversal | false | Close positions when an opposite DI crossover signal fires |
| maxOpenTrades | 1 | Maximum simultaneously open positions per direction |
| costOfSingleOrder | 0.01 | Base trade size value, interpreted by costFormat |
| costFormat | LOT | How trade size is measured: LOT, CURRENCY_AMOUNT, PERCENT_OF_BALANCE, PERCENT_OF_EQUITY |
DCA and Recovery Settings
| Parameter | Default | Description |
|---|---|---|
| useDCA | false | Enable Dollar Cost Averaging |
| activateSLWithDCA | false | Delay stop-loss activation until the first DCA position is opened |
| useAutoLotRecoveryByFJU | FALSE | Lot recovery method: FROM_PAST_TRADES_BY_MAGIC_NUMBER, FROM_EQUITY_BALANCE_DRAWDOWN, or FALSE (disabled) |
| recoveryRangeForPastTrades | 100 | Number of past trades included in the lot recovery calculation |
| additionalPercentageToRecovery | 10.0 | Extra percentage added on top of the calculated recovery amount for a profit buffer |
| closeAllTradesOnEquityHigherThen | 0.00 | Auto-close all trades when equity reaches this value. Set to 0 to disable. |
| useEquityManagerForAutoLotRecovery | false | Link recovery lot calculation to the equity manager for continuous drawdown targeting |
| lastCycleOfADXR | false | Block new positions. EA manages the existing basket to TP or SL then stops. |
EA General Settings
| Parameter | Default | Description |
|---|---|---|
| magicNumber | 260413 | EA identifier. Must be unique per symbol and chart instance. |
| useFillingPolicy | true | Auto-detect the broker fill policy (IOC, FOK, or RETURN) |
| orderComment | FJUNIVERSE | ADXR | TRADE | Comment attached to every order ticket |
Notifications
| Parameter | Default | Description |
|---|---|---|
| brandLinkName | (empty) | Display name for brand link appended to notifications (truncated to 10 characters) |
| brandLinkURL | (empty) | URL for brand link appended to notifications |
| discordNickName | ANONYMOUS | Nickname shown in Discord messages |
| discordWebhookLogs | (empty) | Custom Discord webhook URL for trade entries, exits, and system events. Falls back to the built-in FJUNIVERSE channel if empty. |
| discordWebhookResults | (empty) | Custom Discord webhook URL for closed trade results with branding links. Leave empty to use the built-in results channel only. |
| telegramNickName | ANONYMOUS | Nickname shown in Telegram messages |
| telegramBotToken | (empty) | Telegram Bot API token from BotFather. Leave empty to use the built-in FJUNIVERSE Telegram channel only. |
| telegramChatID | (empty) | Telegram chat or channel ID for notifications |
Installation
- Place FJUNIVERSE_ADX_REGIME in the MQL5 Experts folder
- Open MetaEditor and compile both files (press F7)
- Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart and enable AutoTrading
The EA works on all symbols and all timeframes. For Discord and Telegram notifications, allow the relevant URLs in MetaTrader 5 under Tools, Options, Expert Advisors, Allow WebRequests for listed URLs: https://discord.com and https://api.telegram.org. If notifications are not needed, leave the webhook and token fields empty. The built-in FJUNIVERSE channels will still receive messages unless custom webhooks override them.
Notes
- All signal conditions are AND-gated. Every condition that is enabled must pass simultaneously before the EA opens a trade. Disabling a condition removes it from the check entirely.
- The DYNAMIC strategy mode overrides the andIsADXTrending and andIsADXRising inputs because it manages its own ADX-based regime switching internally.
- CLASSIC_EXTREME_SMART and CLASSIC_EXTREME_SMART_PLUS are designed for use with DCA and maxOpenTrades greater than 1. On the first entry they behave identically to CLASSIC.
- The magic number must be unique per chart instance when running the EA on multiple symbols or timeframes at the same time.
- Percentage-based TP and SL work on all instruments: Forex, Metals, Crypto, Indices, Commodities. No pip or point conversion is needed. The configured percentages are applied exactly as set, with no implicit adjustments.
- The on-chart monitoring table can be hidden by removing the EA from the chart. Chart object cleanup is automatic on EA removal.
- For further documentation, setup files, and community discussion, see the product comments section.
Risk Disclaimer:
Trading involves significant risks, and past performance is not indicative of future results. FJUNIVERSE ADX REGIME EA uses automated trading strategies which amplify both potential profits and losses. Market volatility, economic changes, and unforeseen events can impact performance. There is no guarantee of profits, and you may lose part or all of your invested capital. DCA and lot recovery strategies can amplify losses in prolonged adverse market conditions. Always conduct your own research, assess your risk tolerance, and consider consulting a financial advisor before using this EA. The performance shown reflects test results, but your results may vary due to differences in account size, broker conditions, or execution timing. FJUNIVERSE is not liable for any losses incurred by users of this EA.
