Z4 Trend And Time EA
- Эксперты
- Версия: 1.5
- Обновлено: 24 июля 2026
- Активации: 10
This EA is a time-based algorithmic trading framework designed to demonstrate execution mechanics. Instead of constantly scanning the market, it is programmed to wake up and evaluate market conditions at the hour and minute candle you specify.
HOW IT OPERATES:
When your trigger time arrives, the algorithm performs a multi-layered analysis before making a simulated or trading decision. It looks for an alignment of your customized settings:-
Trend Confirmation: Evaluates the current price action against up to three customizable Moving Averages (EMAs).
-
Momentum & Volatility Filters: Checks MACD, ADX, and ATR to observe if the market is too flat or dangerously chaotic.
-
Execution Safety: Aims to verify if the live spread is within your allowed maximum limit before attempting to send any request to the server.
If the technical filters and safety parameters align at that specific minute, the EA attempts to execute the trade using a calculated lot size that targets your specified risk percentage.
KEY FEATURES:
-
Exact Candle Execution: Designed to trigger at your predefined time window, allowing you to observe specific time-based strategies.
-
Advanced Trade Management: Systematically manages unrealized profits using a Risk/Reward (R-Multiple) Step Trailing Stop algorithm.
-
Strict Server Protection: Built-in request cooldowns and retry limits designed to help prevent server spam and demonstrate compliance with strict broker rules.
-
Daily Forced Close: An optional mechanism that attempts to automatically close all active trades at a specific hour.
LEGAL WARNING AND DISCLAIMER:
This EA, its manual, and all default settings are for educational and software execution purposes only. They do not constitute financial, investment, or trading advice.
To the maximum extent permitted by applicable law, the developer completely disclaims any liability for direct, indirect, incidental, or consequential damages resulting from the use of this software.
Proprietary trading firms frequently change their rules regarding HFT, tick scalping, and EA usage. It is the user's sole responsibility to ensure that the EA's configuration complies with their specific firm's current terms of service. The developer makes no guarantee that using this EA will result in passing a challenge or retaining a funded account.
The security, delay, and spam protection settings included in this EA (Expert Advisor) are developed to help you comply with the strict rules of brokers and proprietary trading firms. However, in algorithmic trading and financial markets, there is no such thing as a 100% guarantee. The developer cannot and will not be held responsible for any rule violations (such as HFT violations, spam bans, etc.), account closures, or any financial losses resulting from server-side delays (lag), temporary disconnections, changes in broker rules, or misconfiguration of the bot. By using this EA, you acknowledge and agree that all responsibilities and risks are entirely your own.
Past performance is not indicative of future results. Please test on a demo account first.
This software is provided 'as is' and 'as available' without any warranty of any kind. The developer does not guarantee that the EA is entirely error-free, bug-free, or will flawlessly execute every intended function under all terminal or server conditions.
While the EA includes default settings for demonstration purposes, every broker's environment has different spreads, slippage, and server delays. Therefore, to fully understand the software's mechanics, it is highly recommended to perform your own backtests and forward tests strictly on a Demo account to observe how the algorithm reacts to these variables.
BROKER EXECUTION & DELAY SETTINGS
These settings are designed to help protect your account from being flagged for server spam or high-frequency trading limits enforced by strict brokers.
- Max Valid Signal Duration (Sec): Works directly with your "Daily Timed Signal". If your exact entry time is 15:00:00, this setting limits the execution window. If set to 20, the EA will only attempt to open a trade between 15:00:00 and 15:00:20. If the broker server lags or spreads spike and don't normalize within these exact 20 seconds, the EA completely ignores the signal to avoid entering a trade too late. 0 disables this.
- Blacklist Max Retry Limit: The permanent hard-stop safety feature. If the EA attempts to modify a trailing stop or force-close an order and the broker rejects it this many times in total (e.g., 18 times), the EA permanently blacklists that specific ticket number and will never attempt to touch it again.
CRITICAL WARNING: Do not set this too low (e.g., 1 or 2). If you set it to 1, a single temporary network glitch while moving the Trailing Stop or executing the Daily Forced Close will cause the EA to permanently blacklist the trade, meaning your trailing stop will freeze forever and your trade won't close at the scheduled time! Recommended: 15-20.
- Server Request Cooldown (Sec): The Baseline Delay (Step 1). This acts as your primary defense mechanism against server spam. It is the standard wait time targeted to pass between any modifications made to the same order. For example, if the Trailing Stop moves your SL, the bot is programmed to wait for this amount of time (e.g., 5 seconds) before sending a new modification request for that specific order. This setting is designed to minimize the risk of spamming the broker on every single price tick.
- Blacklist Error Threshold: The Escalation/Trigger Stage (Step 2). It works directly in connection with the "Cooldown" and "Block Duration". If the bot sends a request (aiming to comply with the 5-second cooldown rule above) but the broker rejects it consecutively (e.g., 3 times in a row), the EA assumes that the server is struggling, lagging, or actively rejecting the action. It then prepares to put that specific order into a much longer "sleep" mode.
- Blacklist Block Duration (Sec): The Penalty Box (Step 3). Linked directly to the "Error Threshold" above. Even if your normal wait time is only 5 seconds, once the bot hits those 3 consecutive errors, this setting overrides the normal cooldown and aims to force the bot into a "sleep mode" for a much longer period (e.g., 30 seconds). Its purpose is to help temporarily stop interacting with that order, giving the broker's server enough time to recover from whatever is causing the errors.
Example of how they work together: The bot tries to move the Trailing Stop and fails. It waits 5 seconds (Cooldown/Step 1). It tries again and fails again. It waits for another 5 seconds. It tries a 3rd time and fails. The bot has reached the Error Threshold (3)! Now, instead of waiting 5 seconds, it is programmed to wait for 30 seconds (Block Duration/Step 3) before making a 4th attempt.
- Min Duration Between Requests (Ms): Global delay. The overall speed limit for the EA across all orders (1000 Ms = 1 Second). It helps to reduce the risk of the EA sending more requests per second than the broker allows (which could potentially be perceived as an HFT violation).
- Min Cooldown Between Ticks (Ms): By skipping extremely fast, insignificant micro-fluctuations in price, this setting aims to reduce the CPU load on your computer or VPS.
- Magic Number: The unique identification number that allows the EA to recognize its own trades. If you are using another EA on the same account, the numbers must absolutely be different.
- Custom Comment: The custom text/label attached to every order opened by the EA.
DAILY TIMED SIGNAL SETTINGS
- Signal Control Hour (0-23) & Minute (0-59): The exact broker server time the EA will wake up and look for a trade setup. The bot is programmed to strike strictly at this exact minute.
CRITICAL WARNING FOR TIMEFRAMES: For the EA to work, a new candle MUST open on your chart at your exact specified time. The bot only executes when that specific time's candle arrives. If the chart's timeframe does not generate a candle at that exact hour and minute, the EA will fail and will not open a trade.
Example 1 (Hour Mismatch): If you set the EA to trigger at 13:00, you CANNOT run it on an H4 (4-Hour) chart. H4 candles open at fixed intervals: 00:00, 04:00, 08:00, 12:00, 16:00. Because there is no candle that opens at 13:00, the bot will not find the trigger moment and will skip the trade.
Example 2 (Minute Mismatch): If you set the time to 15:15, you CANNOT run it on an M30 or H1 chart. H1 candles only open at 15:00 and 16:00. M30 candles only open at 15:00 and 15:30. Since there is no candle that opens exactly at 15:15 on those charts, the EA will fail.
The Solution: Always use a chart timeframe that perfectly matches your trigger time. If your specified time ends in :15, :30, or :45, you must run the EA on M1, M5, or M15 charts to ensure a candle opens exactly at that moment.
STOP LOSS SETTINGS
- Stop Loss Mode: Choose the mathematical logic for your SL:
- SL_FRACTAL: Places SL based on previous structural swing highs/lows.
- SL_FIXED_POINTS: Uses an exact point distance from your entry.
- SL_ATR: Calculates dynamic SL based on live market volatility.
- Min SL Distance (Points): The absolute minimum Stop Loss distance allowed (10 Points = 1 Pip). If the Fractal or ATR mode calculates an SL that is dangerously tight (inside the spread), the EA expands it to this exact value to help protect you from instant spread stop-outs.
- Fractal Left/Right Bars: (Only for Fractal SL). Defines how many candles to the left and right must be lower/higher to validate a swing peak or valley.
- ATR Timeframe / Multiplier / Period: Configures the dynamic ATR SL calculation. (e.g., ATR value × 1.5 Multiplier).
- Use Stop Area Filter: A brilliant safety net. Checks the final calculated SL distance before placing the trade.
- Min / Max Stop Limit Points: Works together with the Area Filter. If the calculated SL is smaller than your Min limit, or larger than your Max limit (meaning the market is too chaotic), the EA flags it as an invalid setup and will NOT trade.
- Use Min SL On Area Fail: Linked to the Min/Max Limits above. If the rule above fails (e.g., SL is out of your allowed range), setting this to True overrides the cancellation. Instead of skipping the trade, it forces the EA to open the trade using your Min SL Distance value.
- This system does NOT trail by standard points. It mathematically trails based on Risk/Reward (R) multiples. (1.0R = Your initial Stop Loss point risk).
- Enable Step Trailing: Turns the system on or off.
- 1. Activation Level (RR): The floating profit milestone required to wake up the trailing engine (e.g., 1.0 means trailing starts when profit equals your initial SL risk).
- 2. Initial Lock Point (RR): Where to move the SL upon the first activation (e.g., 0.0 moves the SL exactly to Breakeven/Entry Price. 0.5 locks in half of your initial risk as guaranteed profit).
- 3. Step Frequency (RR): How much further the profit must travel to trigger the next SL movement.
- 4. SL Shift Amount (RR): How far to move the Stop Loss at every step.
Example of how they work together: If Activation is 1.0, Lock Point is 0.0, Frequency is 1.0, and Shift is 0.5. When price hits 1.0R profit, SL moves to Breakeven (0.0). Then, when price hits 2.0R, SL moves to +0.5R. When price hits 3.0R, SL moves to +1.0R, systematically adjusting the Stop Loss to help protect unrealized profits.
TAKE PROFIT (TP) SETTINGS
- Risk/Reward Ratio (For TP): The EA calculates your exact Stop Loss distance and multiplies it by this value to place your Take Profit. (e.g., A ratio of 3.0 means if your SL is 20 pips, your TP will be exactly 60 pips).
- Risk Percentage (%): Calculates the exact lot size dynamically based on your account balance and Stop Loss distance. If the SL is hit, the EA aims to limit your loss to approximately this percentage (excluding market slippage or gaps).
- Allow Min Lot: If the mathematically calculated lot size is smaller than the broker's minimum (e.g., <0.01), setting this to True forces a 0.01 lot entry. Setting it to False cancels the trade safely.
- Custom Max Lot: A hard ceiling limit. If the risk calculation outputs 20 lots but you set this to 5.0, the EA will forcefully reduce the entry to exactly 5 lots.
- Max Spread (Points): If the live broker spread exceeds this limit at the exact moment of execution, the trade is cancelled. (e.g., 300 points = 30 pips).
- Manual Commission (One Way): Enter your broker's one-way commission per 1 Lot (e.g., 3.0 for $3). The EA mathematically includes this cost directly into the Stop Loss risk calculation, aiming to keep your true loss as close as mathematically possible to your Risk Percentage, even after commission deductions!
- Allow Hedging: If False, the EA strictly blocks opposing signals (e.g., it will ignore a new Buy signal if a Sell trade is currently active).
- Maximum Open Positions: A hard limit on concurrent open trades. Once reached, new signals are ignored.
- The EA uses up to 3 EMAs (Fast, Slow, EMA3) and the current Price to determine the trend. You can enable or disable the Slow EMA and EMA3 independently. The EA will mathematically check the alignment of only the activated indicators.
- Include Price in Alignment: Determines whether the current price MUST be part of the strict trend order.
- Fast EMA / Slow EMA / EMA3 (Period & Offset): Defines your moving average periods.
- ALL ALIGNMENT POSSIBILITIES FOR A BUY (LONG) TRADE:
- (Note: For a SELL trade, the exact opposite < applies).
- All EMAs ON + Price Included (True):
- Condition: Price > Fast EMA > Slow EMA > EMA3 (The most conservative setup).
- Slow EMA is OFF + EMA3 is ON + Price Included (True):
- Condition: Price > Fast EMA > EMA3 (The EA completely ignores the Slow EMA).
- Only Fast EMA is ON + Price Included (True):
- Condition: Price > Fast EMA (The EA ignores the 2nd and 3rd EMAs).
- All EMAs ON + Price EXCLUDED (False):
- Condition: Fast EMA > Slow EMA > EMA3 (Price position does not matter). Even if the current price pulls back and drops below the Fast EMA, the EA will still open a Buy trade because the overall EMA trend is still pointing UP.
- Enable MACD Filter: Acts as a momentum gatekeeper. For a Buy, the MACD Main line MUST be strictly above the MACD Signal line. If not, the trade is cancelled.
- MACD Fast / Slow / Signal: Standard configuration settings for the indicator.
- Use ATR Filter (Min/Max Levels): If the market is too dead (below Min ATR) or violently chaotic (above Max ATR), the EA will ignore the signal.
- CRITICAL WARNING FOR SYMBOLS: ATR values differ radically across symbols. EURUSD ATR might be 0.00150, while XAUUSD (Gold) might be 3.5. Always measure your specific chart's live ATR before setting these bounds!
- Dual ADX System (MTF): Allows you to check trend strength on two different timeframes simultaneously.
- Min / Max ADX Level: ADX measures trend strength (usually 0 to 100). If the momentum is too weak (below Min, e.g., < 22) or dangerously overextended (above Max, e.g., > 60), the EA cancels the entry.
- Use Day Filter: If False, the EA trades every day the market is open.
- Trade Monday to Sunday: Individual toggles for each day of the week. Allows you to block trading on specific days (like Sundays for crypto or Fridays to avoid weekend gaps).
- Enable Forced Time Close: Attempts to mercilessly close all open trades at the exact specified time below. Highly recommended for avoiding overnight swap fees or weekend gaps.
- CRITICAL WARNING FOR SERVER TIME: This function uses BROKER SERVER TIME, not your local computer time! Ensure you calculate your desired closing time based on your broker's "Market Watch" clock.
- Apply ONLY on Fridays: If True, trades can be held overnight during the week but are forced to close on Friday evenings before the market closes.
- Close Hour (0-23) & Minute (0-59): The exact server hour and minute to execute the forced close.
- Show Indicators: Draws the active EMA lines and indicator sub-windows (MACD, ADX, ATR) onto your chart for visual confirmation and backtesting.
- Enable Debug Logs: The ultimate diagnostic tool. Prints human-readable explanations in the MT5 'Experts' tab. If a trade is skipped, the log tells you exactly why (e.g., "CANCELLED: Spread is too high", "MACD not aligned", or "ATR is out of bounds").
