SnapTrend XAU Tick Scalper
- 专家
- 版本: 7.0
- 激活: 8
SNAPTREND XAU TICK SCALPER
Precision Tick-Microstructure Scalping Engine for XAUUSD
v7.00 FINAL — Forensic Hardened · Broker-Adaptive · State-Recoverable · Market Compliant
PRODUCT POSITIONING
The only tick-driven XAUUSD scalping engine that reads raw market microstructure through a 6,000-tick rolling buffer, validates entries via a 5-stage confirmation state machine, executes with broker-adaptive filling logic, and governs exposure through a circuit-breaker-protected basket architecture with persistent state recovery across terminal restarts.
BRAND TAGLINE OPTIONS
1. Where Microstructure Meets Execution Discipline
2. Tick-Resolution Intelligence. Institutional-Grade Governance.
3. The Scalper That Survives the Restart.
INTRODUCING SNAPTREND XAU TICK SCALPER
SnapTrend is the XAUUSD Expert Advisor I built to solve a simple problem: conventional EAs sample candles, react to lagging indicators, and execute blind to broker filling policies. They enter on noise, scale without governance, and lose state on every terminal restart — turning a disciplined strategy into a lottery ticket.
SnapTrend does not treat every tick as a signal. It treats every tick as evidence.
The engine ingests raw tick flow, reconstructs local swing structure, qualifies directional bias through net-move-over-range scoring, and only arms an entry after a confirmed trend. It then waits — patiently — for a pullback, a rebound, and a micro-structural break before committing capital.
Execution is not an afterthought; it is a hardened layer that interrogates the broker's filling mode, respects volume constraints, and falls back gracefully on rejection.
Exposure is governed by a circuit breaker that references pre-trade equity, not depressed post-drawdown equity.
And when the terminal restarts — whether from a VPS reboot, a recompile, or a connection loss — the basket state, cooldown, and drawdown reference are reconstructed from the live order book, not reset to zero.
This is not a script. This is a quantitative trading engine.
ENGINEERING CORE — WHAT MAKES SNAPTREND DIFFERENT
1. Tick-Microstructure Analysis Engine (6,000-Tick Rolling Buffer)
At the heart of SnapTrend lies a circular buffer keyed by server-side millisecond timestamps — not candle derivatives. The engine computes in real-time:
Trend window statistics: net move, range, trend score = |net|/range over configurable 6–12 second windows.
Local swing reconstruction (Model 1): higher-highs/higher-lows or lower-highs/lower-lows validation within 2× trend window.
Tick velocity: ticks/second over 5 seconds for regime awareness.
Micro-break detection: current price versus the highest/lowest of the last N ticks, with epsilon confirmation.
All calculations operate on mid-price from a single per-event SymbolInfoTick() snapshot, eliminating intra-tick price races.
2. Symbol Compatibility Layer — One Parameter Set, Any Broker
Every distance parameter was calibrated on 2-digit gold, where point = 0.01 and price is approximately 3400. SnapTrend automatically translates these to different broker quoting formats.
Digit-scale correction: 2-digit gold to 3-digit gold = ×10, preserving the same price distance.
Price-relative equivalence for non-gold symbols such as EURUSD and indices: scale = (0.01/point) × (price/3400), so the configured distance preserves its percentage-of-price meaning.
The spread gate remains a quoting property — digit correction applies only within the same instrument class.
This architecture is designed to allow the same strategy parameters to adapt across different symbol specifications without manual point-value rewrites.
3. Adaptive Spread Intelligence — Structural Floor, Not Spike Reactivity
The spread gate is not a static number. SnapTrend maintains a decaying structural spread floor — a slow minimum that rises only when the tight spread does not return, indicating a persistent regime change rather than a temporary spike.
When the broker's baseline spread exceeds the configured limit, the gate can relax only up to a capped multiple. The default behavior uses a 1.5× baseline relationship with a hard cap of 3× the input limit.
This prevents the execution layer from treating temporary spread abnormalities as normal conditions while allowing operation on feeds whose structural spread is naturally wider.
4. Broker-Adaptive Execution — Zero Assumptions
Unknown filling mode: reads SYMBOL_FILLING_MODE and SYMBOL_TRADE_EXEMODE, selects a supported filling policy, and provides fallback handling for invalid-fill responses.
Volume constraints: reads VOLUME_MIN, VOLUME_MAX, and VOLUME_STEP, then normalizes volume using the broker's actual specification.
Contract size variance: reads SYMBOL_TRADE_CONTRACT_SIZE and uses it for exposure and margin calculations.
Stops and freeze levels: read from the live symbol specification and logged during initialization.
Execution validation: the server trade retcode is treated as authoritative, CTrade results are cross-checked, and partial fills are handled as successful executions when the server confirms completion.
Deviation control: configurable slippage in points is applied to market orders.
Pure MQL5. No DLL. No WebRequest. No external database dependency.
HOW SNAPTREND THINKS — THE 5-STAGE ENTRY STATE MACHINE
Raw Tick Stream
Then the Rolling Tick Buffer
Then Trend Window Analysis using net move, range, trend score, and direction
Then Directional Qualification using the required trend score and net movement thresholds
Then the Entry State Machine:
Arming — trend qualified, reference floor and ceiling established, timeout started.
Wait Pullback — price moves the required distance from the reference extreme.
Wait Rebound — price reverses the required distance within the configured snap window.
Wait Break — price clears the local high or low of the recent tick structure.
Execute — broker-adaptive order routing combined with the required margin checks.
Then Basket Governance manages the position lifecycle through the configured basket, circuit-breaker, trailing, and cooldown mechanisms.
Two entry models share this pipeline.
Model 1 — Accurate: adds swing-structure validation using higher-highs and lower-highs or lower-highs and lower-lows before arming.
Model 2 — Fast: uses the trend-window qualification directly and skips the additional swing-structure validation stage.
Three sensitivity presets — Low, Medium, and High — shift the configured thresholds coherently.
TICK MICROSTRUCTURE ENGINE — CAPABILITIES
Raw tick ingestion: 6,000-slot circular buffer keyed by server millisecond time.
Gap-safe clock: detects backward timestamp steps and major timing gaps, then protects the internal signal state by clearing stale tick context and resetting the active arming state.
Trend scoring: calculates absolute net movement divided by observed range over configurable short-duration windows.
Swing reconstruction: Model 1 reconstructs local structural peaks and valleys to validate directional continuity.
Micro-break detection: compares the current price against recent local tick extremes to require confirmation beyond the immediate structure.
Tick velocity: measures ticks per second over a five-second window for operational market-state telemetry.
PRECISION ENTRY ARCHITECTURE
The entry process is a finite state machine rather than a single Boolean trigger.
IDLE
The engine remains inactive when directional qualification is not present.
ARMING
A valid trend condition is detected. The reference floor or ceiling is established and the arming timeout starts.
WAIT PULLBACK
Price must move the required distance from the reference extreme before the system progresses.
WAIT REBOUND
Price must reverse the required amount inside the configured snap window.
WAIT BREAK
The engine watches for a break of the recent local high or low.
EXECUTE
The system validates execution conditions, applies broker-specific execution logic, verifies margin requirements, and sends the market order.
EXPIRED
If the required conditions fail to complete within their allowed timing windows, the signal is discarded and the engine returns to the idle state.
No single condition triggers the entry. The complete sequence must be satisfied.
This architecture is designed to reduce:
False breakout entries.
Entries during weak directional conditions.
Chasing extended movement without a pullback.
Premature entries on micro-reversals that fail to produce confirmation.
ADAPTIVE BASKET ENGINE — CONTROLLED, NOT COMPOUNDED
Default Profile: Single-Order Discipline
The shipped configuration uses one order, one wave, and one maximum wave. No averaging, no ladder, and no martingale are required in the default profile.
The default operation is one decision, one position, governed by the configured take-profit, trailing, and circuit-breaker logic.
Ladder Mode — Configurable 2+2+2 Architecture
The engine can be configured for controlled multi-wave exposure.
For example, with Total Orders = 6, Wave Size = 2, and Max Waves = 3:
Wave 1 uses the base lot.
Wave 2 applies the configured wave multiplier.
Wave 3 applies the multiplier to the second wave allocation.
Additional waves are conditional. They require the configured adverse displacement, rebound confirmation, and micro-break conditions before a new wave can be added.
A trend throttle can block additional exposure when the opposing structural trend score becomes too strong.
The breaker lock can freeze further wave additions once the drawdown circuit breaker is triggered.
The maximum position count remains hard-capped and margin safety controls can scale volume down before execution.
RISK AND EQUITY GOVERNANCE — ENGINEERED, NOT HOPED
The system is engineered around exposure governance rather than uncontrolled position accumulation.
Circuit Breaker
Basket drawdown is evaluated against the reference equity established for the trade cycle. When the configured threshold is reached, the system can close the active basket, latch the breaker, and prevent further wave expansion.
Margin Awareness
Before an order is submitted, the system calculates the required margin and applies the configured safety factor. The resulting volume can be reduced or the trade can be rejected when available free margin is insufficient.
Lot Normalization
Volume passes through a controlled normalization path using broker step, minimum, maximum, and per-order limitations.
Compounding
The optional compound model calculates volume using the relationship between current equity and the configured base balance, combined with the configured growth exponent. The base balance can be persisted across restarts.
No Close on Loss
When enabled, this mode can prevent normal profit-target or trailing-based closure while the active position remains at a floating loss, leaving the trade governed by the configured breaker or manual decision.
Trailing
Peak basket profit is tracked and the trailing mechanism can close the basket when profit retraces by the configured percentage after the activation threshold has been reached.
Critical Equity Handling
The breaker reference can be reconstructed after restart from the account equity and floating position result rather than silently rebasing the drawdown budget against already-depressed equity.
BROKER-ADAPTIVE EXECUTION — ZERO ASSUMPTIONS
Unknown filling mode
The engine reads the symbol's supported filling configuration and execution mode and selects an applicable market-order filling policy.
Volume constraints
The engine reads the broker's actual minimum volume, maximum volume, and step size and normalizes order volume accordingly.
Contract size variance
The actual contract size is read from the symbol specification and used in exposure and margin calculations.
Stops and freeze levels
Live symbol specifications are available to the execution layer and are logged during initialization.
Execution validation
The trade server retcode is treated as the authoritative execution result. The internal trade result is cross-checked, and confirmed partial fills are handled accordingly.
Deviation control
Configurable slippage tolerance is applied to market execution.
ADAPTIVE SPREAD CONTROL — STRUCTURAL, NOT REACTIVE
Strict Mode
When adaptive spread is disabled, the configured spread limit is used as the hard execution gate after the relevant symbol scaling.
Adaptive Mode
When enabled, the system builds a decaying spread baseline representing the broker's structural quoting environment.
If the structural baseline exceeds the configured limit, the effective limit can relax according to the configured cap.
Temporary spread spikes do not automatically redefine the baseline.
The result is a spread gate designed to distinguish a structurally wider broker feed from a temporary abnormal expansion.
STATE RECOVERY — THE SCALPER THAT SURVIVES THE RESTART
Basket state, direction, wave count, order count, cooldown state, breaker state, compounding base balance, and drawdown reference information can be persisted through MetaTrader Global Variables.
On initialization, if positions already exist, the system attempts to restore the stored state. If the live positions correspond to the stored state, the internal counters can be synchronized. Otherwise, the basket can be reconstructed from the live position book.
Cooldown deadlines can remain honored after restart.
A latched circuit breaker can remain active until the basket is flat.
The compounding base balance can persist across sessions.
The drawdown reference can be reconstructed using equity and floating profit/loss rather than simply accepting the currently depressed equity as a new starting point.
This architecture is designed to prevent duplicate wave creation and maintain controlled trade management after terminal interruptions.
FORENSIC TRADE INTELLIGENCE — EVERY TRADE LEAVES AN AUDIT TRAIL
Execution Record
The engine records important broker execution information including trade server retcodes, executed volume, execution price, comments, ticket data, and order timing.
Commission Cache
Historical deals are cached and reused to support accurate position-level profit and loss calculations, including commission and swap effects.
MFE and MAE Visibility
The basket tracking and floating-profit history provide ongoing excursion information used by the position-management layer.
Input Audit Log
At startup, the system identifies parameters that are inactive or irrelevant under the current configuration, helping prevent silent misconfiguration.
System Health Telemetry
Tick-buffer depth, timing information, gap-reset activity, commission-cache state, clock mode, and other operational information are available to the monitoring layer.
PROFESSIONAL DASHBOARD — REAL-TIME OPERATIONAL COMMAND CENTER
SnapTrend includes a dedicated two-column terminal dashboard designed for continuous operational visibility.
The interface is updated through an independent timer architecture rather than forcing dashboard rendering into the main tick-processing path.
The dashboard can display:
Header
Current operating mode, symbol, timeframe, magic number, and trading permission.
Signal
Current directional bias, trend-score confidence, regime information, and entry readiness.
Market
Bid, ask, current spread, effective spread limit, adaptive spread status, net movement, observed range, tick age, tick rate, and session information.
Basket
Current basket state, wave progress, order count, average price, exposure, profit/loss, and pending add status.
Risk
Balance, equity, floating profit/loss, basket drawdown, next lot, margin information, and circuit-breaker status.
Execution
Last order direction, volume, price, server result, ticket information, execution age, filling mode, permission, and entry gate.
System Health
Uptime, tick and timer counts, tick-buffer depth, gap resets, commission-cache state, point scaling, and spread baseline.
TESTER AND RESEARCH ENGINE — CONTROLLED TICK-DENSITY BACKTESTING
Tick-driven strategies can become difficult to evaluate correctly when the test environment provides sparse or irregular generated ticks relative to the very short timing windows used by the strategy.
SnapTrend includes a configurable Tick-Density Mode that provides a controlled synthetic strategy clock for tester operation.
Synthetic Clock
A configurable millisecond-per-tick step can be used to create a deterministic internal timing sequence during testing.
Reproducibility
The strategy timing becomes deterministic across repeated runs because the tester timing mechanism does not rely on non-deterministic local timer jitter.
Visual Mode
The dashboard can continue to provide operational information during visual testing.
Optimization Safety
The clock mechanism is designed to avoid introducing non-deterministic local timing into optimization runs.
The mode can be enabled using InpTesterTickDensity = true and configured through InpTesterMsPerTick.
INPUT AUDIT LOGGER — NO SILENT INERT PARAMETERS
At startup, SnapTrend identifies configuration parameters that have no active effect under the selected operating mode.
Examples include:
Fixed lot mode causing compound-sizing parameters to become inactive.
Disabled trailing causing trailing-specific parameters to become inactive.
Model 2 causing swing-specific inputs to become inactive.
Disabled ladder mode causing wave-step, rebound, multiplier, and throttle parameters to become inactive.
Disabled protections being explicitly reported.
The active preset values are also displayed so the operator can see exactly which configuration is actually in effect.
KEY FEATURES — 20 CAPABILITIES WITH COMMERCIAL VALUE
1. Tick-Microstructure Buffer
6,000-tick rolling window with millisecond timestamps for short-duration structural analysis.
2. Trend Score Engine
Net-move-over-range calculation over configurable short windows to quantify directional movement quality.
3. Swing Reconstruction
Higher-high and lower-low structural validation in the accurate entry model.
4. 5-Stage Entry State Machine
Arm, pullback, rebound, micro-break, and execution stages must complete before entry.
5. Dual Entry Models
Accurate swing-confirmation mode and Fast trend-confirmation mode.
6. Symbol Auto-Normalisation
Automatic adaptation to symbol digits, point size, and price-relative scaling.
7. Adaptive Spread Gate
Structural spread baseline with controlled relaxation and abnormal-spread protection.
8. Broker-Adaptive Execution
Supported filling-mode selection, invalid-fill fallback, server-retcode validation, and deviation control.
9. Controlled Wave Ladder
Conditional multi-wave exposure with step, rebound, break, trend-throttle, and breaker-lock controls.
10. Circuit Breaker
Basket drawdown protection based on the configured equity reference.
11. Margin-Aware Sizing
Pre-trade margin calculation combined with configurable safety-factor controls.
12. Compound Lot Engine
Equity-based position sizing using the configured base balance and growth exponent.
13. Trailing and No-Close-On-Loss Controls
Basket-level peak-profit tracking with optional protection against normal closure while floating negative.
14. Persistent State Recovery
Global Variable persistence with live-position adoption and state reconciliation.
15. Forensic Execution Audit
Trade server result, executed volume, price, ticket, timing, and broker comment visibility.
16. Commission-Aware P/L
Historical commission and swap information incorporated into operational profit and loss calculations.
17. Professional Dashboard
Independent timer-driven two-column operational telemetry interface.
18. Tick-Density Tester Mode
Configurable synthetic timing for reproducible short-window strategy testing.
19. Input Audit Logger
Startup reporting of inactive parameters and the actual active configuration.
20. Gap-Safe Strategy Clock
Server millisecond timing with protection against backward time steps and major gaps that could invalidate short-duration signal context.
WHY SNAPTREND — ARCHITECTURE-BACKED DIFFERENTIATORS
1. Microstructure over indicators
The core entry architecture works directly with tick-based price behavior and short-window structural measurements rather than relying exclusively on a conventional indicator stack.
2. Confirmation over prediction
The entry architecture requires a sequence of conditions instead of triggering from a single threshold.
3. Engineered execution
Broker filling rules, volume constraints, margin checks, deviation control, and server execution results are incorporated directly into the execution layer.
4. Structural exposure governance
The circuit breaker, position limits, margin checks, and conditional wave controls provide explicit governance over exposure.
5. Durable trade state
The system maintains persistent information required to reconstruct and continue active trade management after interruptions.
6. Broker adaptability
Symbol specifications and execution constraints are read from the actual trading environment instead of being treated as fixed assumptions.
7. Controlled testing
Tick-density controls provide a deterministic testing environment for strategies whose entry timing depends on very short-duration tick windows.
8. Full operational visibility
The dashboard and audit layer expose market, signal, basket, risk, execution, and system-health information in real time.
WHO IS IT FOR
XAUUSD scalpers who need tick-resolution entry logic rather than relying exclusively on candle-level signals.
Algorithmic traders who require broker-aware execution and persistent trade-state management.
MT5 users operating on RAW, ECN, or low-spread environments.
Strategy developers researching tick-microstructure and short-duration structural behavior.
MQL5 Market users looking for a pure-MQL5 trading system with broker compatibility and operational diagnostics.
Traders who value controlled exposure, execution awareness, and detailed runtime visibility.
TECHNICAL SPECIFICATIONS
Platform: MetaTrader 5 using MQL5.
Primary Market: XAUUSD / GOLD.
Data: Raw tick stream with server millisecond timing.
Entry Architecture: Dual-model state machine using trend qualification, arming, pullback, rebound, and micro-break confirmation.
Position Model: Single-order default or configurable controlled multi-wave ladder.
Risk: Equity circuit breaker, margin safety factor, position limits, and volume caps.
Execution: Broker-aware filling selection, fallback handling, deviation control, and server-retcode validation.
Recovery: Global Variable persistence and live-position state adoption.
Diagnostics: Execution audit, commission cache, input audit, and system-health telemetry.
Dashboard: Two-column operational terminal panel with independent timer updates.
Tester: Configurable tick-density synthetic clock.
RECOMMENDED ENVIRONMENT
Symbol: XAUUSD / Gold as the primary calibrated market.
Timeframe: Any timeframe can be attached because the trading logic is tick-driven; the timeframe primarily affects the chart/dashboard context.
Account: RAW, ECN, or low-spread environments are preferred, although adaptive spread logic can accommodate wider structural spreads.
Leverage: Sufficient leverage to satisfy the configured margin-safety requirements.
VPS: Recommended for continuous 24/5 tick availability and consistent terminal operation.
Spread: Lower baseline spreads are preferred; adaptive spread logic can account for structurally wider feeds.
Tester: Tick-Density Mode can be enabled for short-window research and testing.
Account Type: Hedging is required for multi-position basket management.
RISK DISCLAIMER
SnapTrend is a trading tool, not a profit guarantee. Past backtest performance does not predict future results. The circuit breaker, margin checks, exposure limits, and execution controls are risk-mitigation mechanisms; they do not eliminate market risk or guarantee against loss. Trade only capital you can afford to lose. Validate the EA on a demo environment and evaluate its behavior under the specific broker, symbol specifications, spread conditions, execution model, and account configuration you intend to use.
WHAT YOU RECEIVE
SnapTrend XAU Tick Scalper V2, v7.00 FINAL.
Full parameter guide explaining the available configuration controls.
Dashboard user guide explaining the operational monitoring interface.
Tester configuration guidance for tick-density mode.
Broker compatibility notes covering filling modes, spread handling, volume constraints, and execution behavior.
State-recovery documentation covering terminal restart and position-state reconstruction.
Future v7.x hardening and compliance updates where provided by the product release policy.
Developer support for setup and configuration assistance where provided.
MQL5 MARKET COMPLIANCE — BUILT FOR THE STORE
No DLL imports.
No WebRequest dependency.
No external database requirement.
Pure MQL5 implementation.
Global Variables are used for persistent trade-state storage.
English-language operational logs and dashboard.
Designed around MetaTrader 5 market execution and broker symbol specifications.
SNAPTREND XAU TICK SCALPER V2
Precision Tick-Microstructure Scalping Engine for XAUUSD
v7.00 FINAL — Forensic Hardened · Broker-Adaptive · State-Recoverable · Market Compliant
"The market doesn't move in candles. Neither should your edge."
