Zone Hunter 4HR
- Experts
- Version: 1.2
- Activations: 5
Wait for the zone. Check the direction. Execute the setup. forex pair :- gbpusd , eurusd dervivative :- crash boom 500
Overview
Zone Hunter is an Expert Advisor for MetaTrader 5. It finds price zones on the 4-hour (H4) chart and opens a trade when price comes back to one of these zones.
The robot works with three types of zones:
- Fair Value Gap (FVG) – a gap left by three closed 4-hour candles.
- Inverted Fair Value Gap (iFVG) – a Fair Value Gap that a later 4-hour candle closed through. The zone then works in the opposite direction.
- Order Block (OB) – a zone built from a strong 4-hour candle that changed direction.
A Range Filter checks the trend before each trade, and a direction check makes sure price comes into the zone from the correct side. Every trade opens with a Stop Loss (SL) and a Take Profit (TP). The robot does not use martingale or grid methods.
Main features
- Zones are built only from closed 4-hour candles, so they do not repaint.
- The zones always come from the 4-hour chart, so you can attach the robot to any chart timeframe.
- Range Filter on the 4-hour chart: when the line is white (rising), sell trades are skipped. When the line is blue (falling), buy trades are skipped.
- Direction check: a bullish zone is bought only when price comes down into it. A bearish zone is sold only when price comes up into it.
- Two entry types: when price first touches the zone, and when price reaches the middle (50%) of the zone.
- Take Profit is a fixed number of pips, or the edge of the nearest opposite Order Block if that is closer. When a new Order Block appears, the Take Profit of open trades can be moved closer, never further.
- Early close: a trade can be closed early when a 4-hour candle closes deep inside the zone against the trade.
- Total profit target: closes all open trades of the robot on the symbol when their combined profit reaches your target, with an optional trailing amount.
- News filter: reads the MetaTrader 5 Economic Calendar and pauses new trades before and after news. Includes alerts and a news panel on the chart.
- Daily limits: maximum daily loss and maximum number of trades per day.
- After a restart, the robot reads its trade history, so it does not repeat trades on the same zone.
- Zones are drawn on the chart as colored boxes with labels, together with the Range Filter line.
How it works
- The robot finds Fair Value Gaps, Inverted Fair Value Gaps and Order Blocks on the 4-hour chart.
- The Range Filter and the direction check decide if a buy or a sell is allowed.
- When price comes back into the zone, or to its 50% level, the robot opens a trade.
- The Stop Loss is placed past the far edge of the zone plus a buffer. The Take Profit is fixed or set at the nearest opposite Order Block.
- While the trade is open, the robot can close it early, move the Take Profit closer, close all trades at the profit target, and pause during news.
Requirements
- A hedging account is required, because the robot can hold buy and sell trades at the same time.
- MetaTrader 5, any chart timeframe. Please make sure enough 4-hour history is loaded.
- For Bitcoin and other symbols with a high price, set the input "Manual pip size".
- For symbols without economic news (for example Crash and Boom indices), set "Use news filter" to false.
- Please test the robot in the Strategy Tester and on a demo account before you use it on a real account.
Input parameters
Trade Mode
- Trade FVG (true) – trade the original Fair Value Gap zone.
- Trade iFVG (true) – trade the zone after it breaks and inverts.
- Allow BUY / Allow SELL (true / true) – turn each direction on or off.
Trade Settings
- Lot size (0.01) – fixed lot, used when Risk percent is 0.
- Risk percent (0) – percent of equity to risk per trade. The lot is calculated from the Stop Loss distance. 0 means the fixed lot is used.
- Skip if minimum lot too big (true) – in risk mode, skip the trade if the broker's minimum lot would risk more than 1.5 times the Risk percent.
- Take Profit pips (100) – fixed Take Profit distance.
- Stop Loss buffer pips (30) – Stop Loss distance past the far edge of the zone.
- Magic number for FVG / OB trades (240001 / 240002) – keep the two numbers different.
- Maximum spread points (0) – skip new trades when the spread is higher. 0 means off.
- Trade comment – text added to the start of every trade comment.
Zone Timeframe and Gap Size Filter
- FVG timeframe (H4) – please keep this on H4.
- Minimum gap ATR multiplier (0) – skip gaps smaller than this many times the Average True Range (ATR). 0 means off.
- ATR period (14) – period of the Average True Range used for the gap filter.
- Minimum gap pips (0) – the gap must also be at least this many pips. 0 means off.
Zone Re-entry Settings
- Maximum zone entry trades (3) – maximum trades from the "price touches the zone" entry, per zone.
- Maximum 50% trades (2) – maximum trades from the 50% level entry, per zone.
- Maximum trades per zone (5) – total limit per zone, Fair Value Gap and Inverted Fair Value Gap together.
- Maximum open Order Block positions (5) – 0 means no limit.
- Maximum open FVG positions (0) – 0 means no limit.
- Zone maximum age in bars (0) – 0 means zones do not expire by age.
- Maximum stored zones (117) – the oldest zones are removed first.
- FVG history bars (2000) – closed 4-hour candles used to rebuild the zones at start.
Early Close (FVG and iFVG trades)
- Use zone cut (true) – close a trade early when a 4-hour candle closes deep inside the zone against it.
- Cut minimum zone pips (18) – only for zones of this size or bigger.
- Cut zone percent (60) – how deep inside the zone (in percent) the 4-hour close must be.
Inverted Fair Value Gap
- iFVG ends on opposite break (true) – the zone ends when a 4-hour candle closes back through its other side.
- iFVG bullish and bearish colors – box colors on the chart.
Range Filter (4-hour)
- Use Range Filter (true) – trend filter for Fair Value Gap and Inverted Fair Value Gap trades.
- Use Range Filter for OB (true) – the same rule for Order Block trades.
- Range Filter mode (Line colour) – decide the trend by the line color, or by the candle close compared to the line.
- Sampling period (100) and Range multiplier (3.0) – Range Filter settings.
- History bars (3000) – 4-hour candles used to calculate the filter.
- Show line, Draw bars, Rising, Falling and Flat colors – how the line is drawn.
Entry Triggers
- Trade on zone entry (true) – trade when price enters the zone.
- Trade on 50 percent (true) – also trade when price reaches the middle of the zone.
- Require approach side (true) – buy bullish zones only when price comes from above, sell bearish zones only when price comes from below.
Chart Display
- Show zones (true), Bullish and bearish colors, Show zone label (true).
- FVG box length (20) – box length in 4-hour candles.
- Split FVG at break (true) – the Fair Value Gap box ends and the Inverted Fair Value Gap box starts at the candle that broke it.
- Extend FVG boxes (false) – extend active boxes to the current bar.
- Keep zones after invalid (true) – keep old boxes on the chart as dashed outlines.
Pip Size
- Manual pip size (0) – 0 means automatic. Set it for Bitcoin and other symbols with a high price. For example, 1.0 means 1 pip is a price move of 1.0.
Order Block
- Trade OB (true) – trade 4-hour Order Blocks.
- OB ATR period (14), Minimum flip candle body in ATR (1.1), Use TradingView style ATR (true) – settings for finding Order Blocks.
- Check flip candle (true), Merge overlapping OBs (true), Maximum merge size in ATR (2.0) – rules for joining Order Blocks that overlap.
- Use OB Stop Loss limit (true) and OB maximum Stop Loss pips (50) – the Stop Loss of an Order Block trade is never more than this distance from the entry.
- OB removal tolerance pips (2) – an Order Block is removed when a 4-hour candle wick comes this close to its far edge.
- OB close beyond middle (false) – also remove an Order Block when a 4-hour candle closes past its middle.
- Volume moving average length (20), Trend moving average length (50) – used for Order Block strength and trend.
- OB rebuild bars (5000), OB maximum age in bars (0 means no limit), Maximum stored OBs (50).
- Maximum OB entry trades (3), Maximum OB 50% trades (2) – per Order Block.
- OB colors, strength bars, label text, text size, keep after removal – display settings.
Take Profit at Nearest Order Block
- Use OB target Take Profit (true) – the Take Profit is the nearest opposite Order Block edge when it is closer than the fixed Take Profit.
- Take Profit OB buffer pips (0) – place the Take Profit this many pips before the Order Block edge.
- Move open Take Profit to OB (true) – on each new 4-hour candle, move the Take Profit of open trades closer to a new Order Block. It is never moved further.
Spread Adjustment (sell trades)
- Sell Take Profit spread adjustment (true) and Extra pips (0.5) – the sell Take Profit is raised by the spread, so it closes when the chart price touches the level.
- Sell Stop Loss spread adjustment (false) – also move the sell Stop Loss by the spread.
News Filter
- Use news filter (true) – pause new trades around news. Set to false for symbols without news.
- News currencies (GBP;USD) – currencies to watch, separated by a semicolon. For example EUR;USD for EURUSD, or USD for gold.
- High impact only (false), Include low impact (false).
- Minutes before and after news – high impact 30 and 30, medium impact 15 and 15, low impact 10 and 10.
- Close before high impact news (false) – close the robot's trades before high impact news.
- News keywords – medium and low impact news only counts if its name contains one of these words. High impact news always counts.
- Refresh seconds (15), Look-ahead hours (48).
Total Profit Target
- Use profit target (false) – follow the total profit of all the robot's open trades on this symbol.
- Profit target in account currency (100) – tracking starts when the total profit (including swap and commission) reaches this amount.
- Profit trailing amount (30) – close all trades when the total falls this much from its highest value. 0 means close when it falls back to the target.
Daily Limits
- Maximum daily loss percent (0) – stop new trades for the day when this loss is reached. 0 means off.
- Close on daily loss (false) – also close open trades when the limit is reached.
- Maximum trades per day (0) – 0 means no limit.
News Alerts and Panel
- Show panel (true) – news status and next events in the top-left corner of the chart.
- Alert before news (true, 5 minutes), Alert at release (true), Alert on actual value (true).
- Popup, Sound, Push notification, Email – how alerts are sent.
- Set global variable (false) – share the news pause status with other Expert Advisors.
Risk warning
Trading involves risk. This robot does not guarantee any profit. Results in the Strategy Tester are not real trading results. Please use proper money management and only trade with money you can afford to lose.
If you have questions about the settings, please send me a private message on MQL5.
