Horizon Cross
- Uzmanlar
-
Steve Zoeger
Hello to my Fx friends. Forex is so diverse that you can't really single out any particular indicator or strategy. The ever-changing market and the ever-changing economic conditions around the world mean that there are many different ways to trade, so I have developed many different robots. These - Sürüm: 1.20
- Etkinleştirmeler: 5
What It Is
Horizon Cross is an automated Expert Advisor for MetaTrader 5 that trades Stochastic K/D crossovers, optionally filtered by a multi-timeframe trend consensus. It works on any symbol (forex, metals, indices, crypto — anything your broker offers) and any timeframe (M1 through W1). It is fully self-contained: all indicators are created inside the EA, so you don't need to add anything to the chart.
How It Works — The Logic in Plain English
The EA does three things, in order, on every new bar:
1. Detect a Stochastic Cross
On the current chart timeframe, it compares the last closed bar (bar 1) with the bar before it (bar 2):
| Condition | Signal |
|---|---|
| K was below D, now K is above D | Bullish cross → BUY |
| K was above D, now K is below D | Bearish cross → SELL |
Because it only reads closed bars, the signal never repaints. Once a cross is confirmed on a closed candle, it stays confirmed.
Optional filter (InpUseCrossFilter ): if enabled, a bullish cross only counts when K is still below the oversold level (default 15), and a bearish cross only counts when K is above the overbought level (default 88). This removes weak mid-range crosses. With it off (the default), every K/D cross fires.
2. Optional Multi-Timeframe Trend Check
If InpUseTrendFilter = true , the EA asks 14 timeframes (M1 → W1) what they think:
-
Each timeframe votes UP if EMA20 > EMA50, or DOWN if EMA20 < EMA50
-
MACD and RSI can add extra votes per timeframe (toggleable)
-
The EA aggregates: ≥60% of valid timeframes UP → trend is UP; ≥60% DOWN → trend is DOWN; otherwise SIDE
Then the filter kicks in:
-
BUY is blocked if trend is DOWN
-
SELL is blocked if trend is UP
-
SIDE lets everything through
Timeframes with too little history (InpMinTFBars , default 200) abstain rather than vote wrong — so short backtests on high timeframes don't get corrupted.
3. Execute the Trade
Two execution styles:
SIMPLE mode — one position at a time with fixed SL/TP in pips. Straightforward, clean, recommended for first testing.
MARTINGALE mode — builds a basket. Opens the first position, then if price moves against it by a step (default 25 pips × current count), adds another lot multiplied by InpMartLotMult (default 1.2×). The whole basket closes as soon as total profit hits InpMartTarget (default $1.00). No individual SLs; the basket target and the drawdown/equity protection are the exits.
Works on Everything
Symbols
| Symbol type | Works? | Notes |
|---|---|---|
| Forex majors/minors | ✅ | Ideal — tight spreads |
| Gold, Silver | ✅ | Use a realistic spread filter |
| Indices (US30, NAS100, GER40) | ✅ | Raise InpMaxSpreadPips |
| Crypto (BTCUSD, ETHUSD) | ✅ | Wide spreads — disable spread filter or raise limit |
| Stocks / CFDs | ✅ | Same as above |
Timeframes
| Timeframe | Works? | Best for |
|---|---|---|
| M1 – M5 | ✅ | Scalping, needs low spread |
| M15 – M30 | ✅ | Sweet spot — enough signals, manageable noise |
| H1 – H4 | ✅ | Swing trading, fewer but cleaner signals |
| D1 – W1 | ✅ | Long-term; may take weeks to produce a trade |
No symbol or timeframe needs to be declared anywhere. The EA reads the chart it's attached to and adapts automatically.
Installation
-
Open MetaTrader 5 → File → Open Data Folder
-
Navigate to MQL5/Experts/
-
Drop the EA file there
-
Back in MT5 → Ctrl+M (MetaEditor) → open the file → F7 (Compile)
-
Confirm 0 errors, 0 warnings at the bottom of MetaEditor
-
Return to MT5 → refresh the Navigator panel → drag the EA onto a chart
First-Run Checklist
Before enabling full features, do a verification run to confirm the EA trades on your symbol:
| Input | Value |
|---|---|
| InpTradeMode | MODE_SIMPLE |
| InpUseTrendFilter | false |
| InpUseCrossFilter | false |
| InpUseSpread | false |
| InpUseTradeTime | false |
| InpEnableMartingale | false |
| InpBaseLot | 0.01 |
| InpLotMode | LOT_FIXED |
| InpUseTrail | true |
Attach to EURUSD M15 with a demo account of at least $1,000. Within a day or two you should see trades in the Journal and on the chart. This proves the pipeline works end-to-end.
Once confirmed, re-enable each filter one at a time — starting with InpUseCrossFilter = true , then InpUseTrendFilter = true , then martingale — observing behavior at each step.
Key Input Groups Explained
Stochastic Cross Entry
These control the signal itself. K period , D period , Slowing follow the standard Stochastic definition. Oversold / Overbought levels only matter when InpUseCrossFilter is ON.
Multi-TF Trend Confirmation
Toggle InpUseTrendFilter to require broader agreement before trading. The three indicators inside the vote (EMA, MACD, RSI) can each be enabled or disabled to taste. InpMinTFBars is a safety floor — any timeframe with fewer bars abstains.
Time Window
Restrict trading to specific hours and weekdays. Overnight sessions (start time later than end time) are handled correctly.
Trade Management
InpMagic tags every trade so the EA never touches positions opened manually or by other bots on the same account. InpMaxSpreadPips blocks entries during wide-spread conditions (news, session gaps).
Simple Mode
Fixed SL and TP in pips. Simple and predictable. Best for verifying the strategy's raw edge.
Martingale
Basket target in account currency (InpMartTarget ), step size in pips, lot multiplier, and a hard cap (InpMartMaxLot ). Set InpMartMaxTrades conservatively — 100 is aggressive; 10–20 is prudent for most brokers.
Lot Size
LOT_FIXED always uses InpBaseLot . LOT_DYNAMIC grows the lot as the account profits — every $InpLotPerUSD of balance growth adds InpLotStep to the base lot. Useful for compounding.
Protection
InpUseDD stops all trading (or pauses) if equity drops X% from peak. InpUseEqFloor is a hard account-balance floor. Both are off by default; turn on for live accounts.
Trailing Stop
Once a position is in profit by InpTrailStart pips, the SL trails at InpTrailDist pips behind price, only moving in the trade's favor. Breakeven is applied first if InpUseBreakeven is on.
UI Badge
Center-of-chart label showing the EA name, version, and a live TREND: UP / DOWN / SIDE indicator (green / red / gold). Recenters itself automatically when the chart is resized. Turn off with InpShowBadge = false if you prefer a clean chart.
What You See While It Runs
On the Chart
-
Center badge — EA title plus live trend status
-
Yellow bullish candles, red bearish candles — chart automatically recolored on attach
-
Grid off, dark background — clean modern look
-
Any open positions appear on the chart with their SL/TP lines
In the Journal (Toolbox → Experts)
Horizon Cross EA initialized. TFs active: 14 Horizon Cross SIGNAL: BUY | Stoch Bullish Cross (K=14.2 D=16.1, prev K=13.8 D=16.9) Horizon Cross SIMPLE BUY 0.01 lots | Stoch Bullish Cross ... Horizon Cross MARTINGALE basket started: BUY 0.01 lots @ 1.08432 Horizon Cross martingale step 2: 0.01 lots Horizon Cross basket target hit: 1.03 -> close all Horizon Cross DRAWDOWN 20.14% -> closing all
Every decision is logged. Nothing is silent.
Common Questions
Why did the EA close my position — I didn't set a TP?
In MARTINGALE mode, positions have no individual TP; the basket closes as a group when the target is hit. In SIMPLE mode, TP is fixed per trade.
Why isn't it trading right now?
Check in order: (1) Is it a trading day/time? (2) Is spread above InpMaxSpreadPips ? (3) Has a new bar closed since you attached it — the EA only decides on new bars? (4) Is InpUseTrendFilter blocking the cross? The Journal will show you which.
Can I run it on multiple charts at once?
Yes — but set a unique InpMagic per chart so the baskets don't mix. Run EURUSD M15 with magic 101, GBPUSD M30 with magic 102, etc.
Will the chart indicators appear?
No — the EA uses internal handles, so nothing is drawn on the chart except the badge. The Stochastic values it uses are computed invisibly.
Can I attach it mid-session?
Yes. It waits for the next new bar before evaluating. It will not enter on the currently forming candle.
Does it require a VPS or always-on machine?
For live automated trading, yes — the EA only acts while MT5 is running. For backtesting and demo, no.
What happens if I stop the EA manually?
Existing positions stay open. Reattach the EA later and it will resume managing them because the magic number matches. Or close them manually.
Is it safe to leave unattended?
With InpUseDD = true and a sensible InpMaxDDPct , yes — the EA self-protects. Without those enabled, martingale mode can draw down substantially. Set protections before live trading.
Recommended Configs by Style
Conservative (learning / early live)
TradeMode = SIMPLE UseTrendFilter = true UseCrossFilter = true UseTrail = true UseDD = true, MaxDDPct = 10 BaseLot = 0.01, LotMode = LOT_FIXED Timeframe = M15 or M30
Standard swing
TradeMode = SIMPLE UseTrendFilter = true UseCrossFilter = false UseTrail = true UseDD = true, MaxDDPct = 15 BaseLot = 0.01, LotMode = LOT_DYNAMIC, LotPerUSD = 500 Timeframe = H1 or H4
Aggressive (martingale basket)
TradeMode = MARTINGALE EnableMartingale = true MartStepPips = 25 MartLotMult = 1.2 MartMaxLot = 1.0 MartMaxTrades = 10 MartTarget = 5.00 UseDD = true, MaxDDPct = 20 UseEqFloor = true, EqFloorPct = 85 Timeframe = M15
Summary of Behavior
| Aspect | Detail |
|---|---|
| Decision frequency | Once per new bar |
| Repaints? | Never — reads only closed bars |
| Reacts to forming candle? | No |
| Signals on which timeframe? | Whatever chart it's attached to |
| Trend filter looks at how many timeframes? | 14 (M1 → W1) |
| Works on any symbol? | Yes — no hardcoded pairs |
| Requires companion indicator? | No — fully self-contained |
| Logs every signal? | Yes — Journal shows K, D, previous K, previous D |
| Protects the account? | Yes — drawdown stop, equity floor, margin clamp |
| Alerts? | Optional alert per signal (InpAlertOnCross ) |
| Auto-recolors chart? | Yes — yellow/red candles, dark background |
| Survives restart? | Yes — resumes managing positions via magic number |
| Multiple instances? | Yes — use a unique magic per chart |
Final Word
Horizon Cross gives you one clear idea — Stochastic crosses — wrapped in professional-grade trade management: adaptive lots, trailing stops, drawdown protection, optional trend filtering, and martingale baskets. Every choice is configurable, nothing is hidden, and every signal is logged.
Start conservative. Verify on demo. Enable features one at a time. Scale position size only after you've seen a full market cycle through the strategy's behavior.
That's the whole game.
