FJ Universe Quant Intelligence
- 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: 2.0
- Activations: 5
Overview
FJ UNIVERSE Quantum Intelligence EA is a fully automated Expert Advisor for MetaTrader 5 that uses a Markov regime-switching model as its core signal engine. Instead of a classic indicator, the EA classifies the market into one of three regimes, Bull, Bear, or Sideways, by measuring the rolling log-return of price over a configurable lookback window. It then builds a live transition matrix, learning the probability that the current regime is followed by an up move versus a down move, and condenses this into a single directional signal. A trade is only considered when this probability edge is strong enough to leave a configurable dead-zone, which keeps the EA flat in choppy, directionless markets and ensures positions are opened only when the model shows genuine statistical conviction.
The EA is built on the proven FJUNIVERSE family shell shared by ADX REGIME, RSI MACDON and HFT TURBO. It includes eight trading strategy modes, an optional Dollar Cost Averaging system, an optional Auto Lot Recovery calculator, a strict multi-layer risk block with daily, weekly, consecutive-loss and drawdown kill-switches, an over-leverage Margin Manager, a live on-chart monitoring panel in the top-right corner, 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. The model is causal and walk-forward by design, learning only from completed bars so there is no look-ahead bias. It was tested most robustly as a Daily, long-only, trend-persistence system on trending instruments.
Signal Engine - Markov Regime Conditions
Every trade entry is gated by the FJU Quantum engine. The following logic drives the signal:
- Regime classification: the rolling log-return over the lookback window labels the current bar as Bull (strong up), Bear (strong down), or Sideways (inside the threshold band)
- Adaptive or fixed thresholds: in adaptive mode the Bull/Bear boundary self-calibrates to each market's own volatility using a rolling quantile of absolute returns; in fixed mode a constant percentage threshold is used instead
- Causal transition matrix: after every completed bar the EA records the regime transition and updates a Laplace-smoothed 3x3 probability matrix, learning the odds of what comes next
- Directional signal: the signal equals the probability of the next move being Bull minus the probability of it being Bear; the absolute value is the confidence
- Entry dead-zone: a LONG is considered only when the signal rises above the positive threshold, a SHORT only when it falls below the negative threshold; inside the band the EA stays flat
- Exit on regime flip: an open position can be closed the moment its directional edge is lost, cutting losers early
- Direction filter: short trades can be disabled entirely for long-only operation, the most robust setting on up-biased assets
The lookback window, smoothing factor, minimum learning sample, and entry threshold are all configurable. The model only learns and acts on completed bars to avoid false intra-bar signals.
Markov Regime Framework
The EA divides every market into three regimes using the rolling log-return of price:
- Bull: the return over the lookback window is strongly positive. The model leans long and the transition matrix learns how often a Bull regime persists.
- Bear: the return is strongly negative. On up-biased assets the long-only default keeps the EA out of these phases rather than shorting them.
- Sideways: the return is inside the threshold band. This is treated as a no-edge, cool-off state; the signal usually sits inside the dead-zone and the EA stays flat.
Because the matrix is rebuilt continuously from real, completed bars, the model adapts to each instrument over time rather than relying on a fixed rule. Adaptive thresholds let the same single configuration generalize across stocks, metals and crypto without per-market curve-fitting.
Trading Strategies
| Strategy | Description |
|---|---|
| CLASSIC | Opens one position in the direction of the Markov signal. Only one position is held at a time per magic number. The recommended default. |
| TREND | While the Markov edge is active, uses the direction of the last completed candle as the entry trigger. Buys when the last candle closed up, sells when it closed down. Momentum confirmation. |
| REVERSE | Counter-trend mode. While the Markov edge is active, enters against the last completed candle: buys after a down candle, sells after an up candle. Designed for mean-reversion behaviour. |
| CLASSIC_EXTREME | Same direction logic as CLASSIC but adds a new position on every confirmed signal even while positions are already open. This is the mode that powers DCA averaging when useDCA is enabled. |
| TREND_EXTREME | Trend-confirmation variant that opens only when no position is currently open, giving a single confirmed momentum entry per cycle. |
| REVERSE_EXTREME | Reverse-confirmation variant that opens only when no position is currently open, giving a single counter-trend entry per cycle. |
| CLASSIC_EXTREME_SMART | Opens the first trade using standard CLASSIC logic. For subsequent entries (with DCA enabled) it only adds a new position when a valid Markov signal fires AND the current price is better than the average open price of all existing positions in that direction. For longs the ask must be below the current average, for shorts the bid must be above it. Prevents averaging into worse levels. |
| CLASSIC_EXTREME_SMART_PLUS | Same smart logic as CLASSIC_EXTREME_SMART but compares the current price against the most favourable existing entry (the lowest long entry or the highest short entry) instead of the average. A stricter filter that ensures every new position in the basket is at a genuinely better level than the best one already held. |
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. The default 6 percent take-profit against a 2 percent stop-loss gives a 3:1 reward-to-risk shape that lets winners run while losers are cut. Close on regime flip is also available as an independent exit method, closing a position the moment its directional edge fades.
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. DCA averaging is most effective with the CLASSIC_EXTREME and SMART strategy modes.
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 keeps the recovery lot within broker volume limits, and the Margin Manager described below provides a second layer of over-leverage protection. Both DCA and Auto Lot Recovery are disabled by default and should be tested on a demo account before live use.
Strict Risk Block
An always-on, multi-layer risk block protects the account. Each layer can be tuned or switched off independently, and a hard limit will flatten all open positions immediately:
- Daily loss kill-switch: halts new trades for the rest of the day once the day's loss reaches the configured percentage of equity
- Weekly loss kill-switch: halts new trades once the week's loss reaches the configured percentage
- Maximum consecutive losses: pauses entries after a configurable number of losing trades in a row; a Sideways regime clears the streak (set to 0 to disable)
- Maximum trades per day: caps how many new positions can be opened each day, suited to a calm Daily strategy
- Maximum drawdown halt: the hard backstop. If equity falls the configured percentage below its peak, the EA flattens everything and stops opening new trades
The current status of every layer, your day and week profit and loss, drawdown, and losing streak are all shown live on the on-chart panel.
Margin Manager
The Margin Manager is an over-leverage damage-control layer that runs on every tick. If used margin crosses the configured threshold percentage of total margin, the EA scans its own open positions and banks any leg that is in profit above a minimum percentage, freeing margin without ever closing a losing position. This protects the account during deep DCA sequences. When it acts, an orange notification is sent to Discord summarizing how much was banked.
Equity Target Auto-Exit
A specific equity value can be configured. When the account reaches that level, the EA closes all open positions immediately and removes itself. 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 regime-flip exit logic, then removes itself once flat. 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 evaluates its strategy once per completed bar, on candle close. This confirmed-signal approach matches the model's Daily, trend-persistence design, avoids false intra-bar signals, and keeps CPU usage low so multiple instances can run comfortably on the same terminal. The Margin Manager and the hard drawdown kill-switch are the exceptions: they are checked on every tick for immediate capital protection.
On-Chart Monitoring Table
A live monitoring panel is drawn in the top-right corner of the chart, updated on every new bar. The table displays the engine status (ACTIVE, WARMUP while the model is still learning, or RISK HALT), the current regime, the directional signal and confidence, the learned probability of the next move being Bull and Bear, the current bias, the number of learned samples against the minimum required, the active mode (fixed or adaptive, long-only or long-short), whether DCA and recovery are enabled, and your live day profit and loss, week profit and loss, drawdown and losing streak. This lets you see at a glance what the model is thinking and how your risk looks, 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, regime-flip closes, risk kill-switch events, Margin Manager actions, 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
FJU Quant Engine
| Parameter | Default | Description |
|---|---|---|
| InpLookback | 40 | Lookback window in bars used to measure the regime log-return. On Daily charts 40 is roughly two months. |
| InpAdaptive | true | Self-calibrating thresholds. When true the Bull/Bear boundary adapts to each market's own volatility; when false the fixed percentages below are used. |
| InpBullPct | 2.0 | Fixed-mode Bull threshold as a percentage. A move above this counts as Bull. Ignored while adaptive is on. |
| InpBearPct | 2.0 | Fixed-mode Bear threshold as a percentage. A move below the negative of this counts as Bear. Ignored while adaptive is on. |
| InpAdaptWin | 200 | Calibration window in bars for adaptive thresholds. |
| InpAdaptQ | 0.70 | Adaptive quantile (0-1). 0.70 means a bar counts as Bull or Bear only when its move is in the top 30 percent of recent moves. |
| InpAlpha | 1.0 | Laplace smoothing applied to the transition matrix so markets with little history do not produce extreme probabilities. |
| InpMinSamples | 30 | Minimum learned transitions required before the EA may trade. Below this the panel shows WARMUP. |
| InpEntryThresh | 0.10 | Entry dead-zone. The signal must exceed plus or minus this value to act, keeping the EA flat in chop. |
| InpAllowShort | false | Allow short trades. Off means long-only, the most robust setting on up-biased assets. |
| InpExitOnFlip | true | Close an open position when the regime edge is lost. |
FJU Quant Order Sizing
| Parameter | Default | Description |
|---|---|---|
| QUANT_TP_PERC | 6.0 | Take-profit distance as a percentage of entry price. |
| QUANT_SL_PERC | 2.0 | Stop-loss distance as a percentage of entry price. |
| costOfSingleOrder | 1 | Base trade size value, interpreted by costFormat. |
| costFormat | PERCENT_OF_BALANCE | How trade size is measured: LOT, CURRENCY_AMOUNT, PERCENT_OF_BALANCE, PERCENT_OF_EQUITY. |
| tradingStrategy | CLASSIC | One of eight strategy modes: CLASSIC, TREND, REVERSE, CLASSIC_EXTREME, TREND_EXTREME, REVERSE_EXTREME, CLASSIC_EXTREME_SMART, CLASSIC_EXTREME_SMART_PLUS. |
FJU Quant Risk Block
| Parameter | Default | Description |
|---|---|---|
| useRisk | true | Master switch for the whole risk block. |
| maxDailyLossPct | 3.0 | Daily loss kill-switch as a percentage of equity. Halts new trades and flattens on a hard breach. |
| maxWeeklyLossPct | 6.0 | Weekly loss kill-switch as a percentage of equity. |
| maxConsecLosses | 0 | Pause entries after this many consecutive losses; a Sideways regime clears the streak. 0 disables this rule. |
| maxTradesPerDay | 1 | Maximum new trades opened per day. 0 means unlimited. |
| maxDDPct | 25.0 | Hard equity drawdown halt. If equity falls this far below its peak, the EA flattens everything and stops trading. |
FJU Margin Manager
| Parameter | Default | Description |
|---|---|---|
| useMarginManager | true | Enable the over-leverage Margin Manager. Recommended on; it only acts when the account is genuinely stressed. |
| MMThresholdPerc | 75 | Used-margin percentage that triggers the Margin Manager. 0 disables it. |
| MMMinProfitPerc | 0.1 | Only positions at least this percentage in profit are banked when the manager triggers. |
Strategy Upgrade - DCA and Recovery
| Parameter | Default | Description |
|---|---|---|
| useDCA | false | Enable Dollar Cost Averaging with a shared basket take-profit from the average price. |
| activateSLWithDCA | false | Manage a shared stop-loss for the DCA basket; otherwise the basket runs to its shared take-profit only. |
| useAutoLotRecoveryByFJU | FALSE | Lot recovery method: FROM_PAST_TRADES_BY_MAGIC_NUMBER, FROM_EQUITY_BALANCE_DRAWDOWN, or FALSE (disabled). |
| recoveryRangeForPastTrades | 100 | Number of past closed trades included in the lot recovery calculation. |
| additionalPercentageToRecovery | 10 | Extra percentage added on top of the calculated recovery amount as a profit buffer. |
| useEquityManagerForAutoLotRecovery | true | Link recovery to the equity manager so the basket is reset once equity recovers, for the equity-drawdown mode. |
| closeAllTradesOnEquityHigherThen | 0.00 | Auto-close all trades and remove the EA when equity reaches this value. 0 disables it. |
| lastCycleOfQUANT | false | Block new positions; the EA manages the existing basket to TP, SL or flip-exit then stops. |
EA General Settings
| Parameter | Default | Description |
|---|---|---|
| magicNumber | 260617 | EA identifier. Must be unique per symbol and chart instance. |
| useFillingPolicy | true | Auto-detect the broker fill policy (IOC, FOK, or RETURN). |
| orderComment | FJUNIVERSE.COM | QUANT | TRADE | Comment attached to every order ticket. |
Notifications
| Parameter | Default | Description |
|---|---|---|
| brandLinkName | (empty) | Display name for a brand link appended to notifications (truncated to 10 characters). |
| brandLinkURL | (empty) | URL for the 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_QUANT_INTELLIGENCE in the MQL5 Experts folder
- Open MetaEditor and compile the file (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, but it was designed for and tested most robustly on the Daily (D1) timeframe of trending instruments such as major US stocks, gold, silver and large-cap crypto, in long-only mode. 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
- The model is causal and walk-forward: it learns only from completed bars, so there is no look-ahead bias and the on-chart numbers reflect what was knowable in real time.
- The EA needs to collect at least InpMinSamples learned transitions before it will trade. Until then the panel shows WARMUP. On a Daily chart with full history this is usually immediate.
- Long-only with adaptive thresholds is the recommended starting configuration. Short trades and fixed thresholds are available for genuinely two-sided or specialized instruments.
- CLASSIC_EXTREME, CLASSIC_EXTREME_SMART and CLASSIC_EXTREME_SMART_PLUS are designed for use with DCA. On the first entry CLASSIC_EXTREME_SMART and its PLUS variant behave identically to CLASSIC.
- DCA and Auto Lot Recovery are powerful but higher-risk and are disabled by default. Test them on a demo account before enabling them live.
- 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.
- The on-chart monitoring table is removed automatically when the EA is removed from the chart.
- 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. FJ UNIVERSE Quantum Intelligence EA uses automated trading strategies which amplify both potential profits and losses. The Markov model has a real but selective edge; backtests are not promises, and out-of-sample results are more modest than in-sample history. 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.
