HTF Candle Sweep Signals
- Индикаторы
-
Allan Aparece Ninal
Я разрабатываю индикаторы и советники (Expert Advisors) для MetaTrader 5.
Как я работаю:
- Каждый индикатор проверяется на перерисовку: сигналы определяются только на закрытых барах, а тест на каждом тике подтверждает, что они потом не меняются. - Версия: 1.0
HTF Candle Sweep Signals is a free indicator for MetaTrader 5. It draws higher-timeframe candles on your chart and marks the previous candle's high and low. It signals a sweep: a candle went beyond that high or low, then closed back inside. Arrows appear when the higher-timeframe candle is complete and do not move afterwards. Attach it to a chart, or watch it on history in the Strategy Tester's visual mode.
It draws, marks and alerts. It does not trade. It places no orders and promises no profit. The section How it was checked shows what held up.
Standalone: everything is built in. You do not need to buy or install any other product named on this page.
In plain words
A daily candle holds 24 hourly candles. Many traders watch the higher-timeframe candle because its open, high, low and close show where price traded over a longer span. This indicator draws those candles on the chart you already use.
The idea behind the signal is simple. Take two higher-timeframe candles in a row. If the second one goes above the first one's high but closes back below it, price reached beyond the high and did not stay there. That is a sweep. The mirror at the low is a buy sweep. This idea is often called candle range theory.
Traders also describe a candle as three phases: the open, a move against the main direction (the sweep), and the move that follows. The dashed open line and the dashed forming candle let you see which phase the current candle is in.
A sweep is context for your own decision. It does not say that price will reverse.
What you see on the chart
- Each completed higher-timeframe candle is a soft green or red body with a thin wick, drawn over the time it covers. Green closed above its open, red below.
- The forming candle is dashed and labelled, for example H4 forming. It changes until it is complete, and no signal ever uses it.
- A dashed line marks the forming candle's open. Dotted blue lines mark the previous candle's high and low, named PH and PL.
- A small pill in the bottom left says what the forming candle has done so far. It reads inside the previous range, swept the previous high, swept the previous low, or swept both.
- When a candle completes with a sweep, its last chart bar gets an arrow. Red above the bar means a sweep of the high (sell). Green below it means a sweep of the low (buy). A short line shows the swept level.
Worked example: a sell sweep
EURUSD H1 chart, higher timeframe H4, default settings, from the parity test of the indicator, on broker history in server time.
| H4 candle opens | Open | High | Low | Close |
|---|---|---|---|---|
| 19 Nov 2026 08:00 (previous) | 1.09651 | 1.09998 | 1.09626 | 1.09920 |
| 19 Nov 2026 12:00 (sweeping) | 1.09919 | 1.10095 | 1.09840 | 1.09985 |
The 12:00 candle went above the previous high 1.09998 (it reached 1.10095). Its low 1.09840 stayed above the previous low 1.09626. It closed at 1.09985, back below 1.09998. The last H1 bar of that candle opened at 15:00. When it closed, a red sell arrow appeared above it, and it stays there.
Key facts
| Type | Indicator drawn on the price chart, for MetaTrader 5. |
| Draws | Higher-timeframe candles with body and wick. The forming candle is dashed, with its open line. Also the previous candle's high and low, and sweep arrows with a name and a line at the swept level. |
| When a signal is final | A sweep arrow is final when the last chart bar of the sweeping candle has closed and the next bar has opened. The arrow, the buffer value and the alert never change afterwards. The forming bar stays empty. |
| Reload and timeframe change | Everything is calculated again from closed bars and comes out the same, with the same inputs and the same history. No alerts are sent for old signals. |
| Alerts | Pop-up and push are on. Sound and e-mail are off. One alert per closed bar, for sweeps. Alerts are silent in the Strategy Tester. |
| Trades | No. It places no orders. |
| Other products needed | None. |
| Symbols and timeframes | Any symbol. Any chart timeframe from M1 to W1, with a higher timeframe above it: M15, M30, H1, H4, D1, W1 or MN1. Tested on EURUSD, GBPJPY, XAUUSD and BTCUSD. |
| Higher-timeframe candles | Built from the chart's own bars, so no other timeframe has to be loaded. They match the platform's own candles, as the section How it was checked shows. |
Quick start
- Attach it to any chart. Candles, lines and arrows appear at once. The defaults work without tuning.
- The higher timeframe is chosen for you. M1 shows M15, M5 shows H1, M15 and M30 show H4, and H1 to H12 show D1. D1 shows W1, and W1 shows MN1. Pick another one in the first input.
- Read the pill at the bottom left. It tells you what the forming candle has done.
- Choose your alert types. Pop-up and push alerts are on by default. Push needs your MetaQuotes ID under Tools, Options, Notifications.
Who it is for
For traders who read the higher-timeframe candle on a lower-timeframe chart. It marks the previous high and low, and the sweeps of them, without switching charts.
Not for you if you want a trading system. It draws, marks and alerts. I have not tested sweeps as a trading rule.
How it works under the hood
Higher-timeframe candles from chart bars
The indicator groups the chart's closed bars by the period of the higher timeframe. Each period gives one candle: the open of its first bar, the highest high, the lowest low and the close of its last bar.
Periods follow the broker's server time. H1 and H4 start on the hour grid. D1 starts at server midnight. W1 starts on Sunday 00:00, as the platform's weekly bars do. MN1 starts on the first of the month.
The first candle that the indicator sees may start before its data, so it is never used as a reference or as a sweeping candle. With the default 5000 bars, that is the oldest candle only.
The sweep rule
Let the previous completed candle have high PH and low PL, and the candle just completed have high H, low L and close C.
- Sell sweep: H is above PH, L is not below PL, and C is below PH.
- Buy sweep: L is below PL, H is not above PH, and C is above PL.
A candle that goes beyond both sides is not a sweep. With a minimum sweep above 0, H must reach beyond PH (or L beyond PL) by at least that share of the previous candle's range.
When a signal is final
A candle is complete when the next chart bar opens in a later period. The arrow goes on the last chart bar of the sweeping candle. It appears when that bar has closed and the next bar has opened, and it does not move afterwards.
Before a weekend or holiday gap, the next bar opens late. The arrow then appears when trading resumes, still on the last bar of its candle.
The forming candle is drawn from the bars so far, and the pill reads it. It is never used for an arrow, a buffer value or an alert.
Reload, restart and timeframe change
After a reload, a terminal restart or a timeframe change, the indicator feeds the closed bars again and redraws everything. With the same inputs and the same history, the arrows land on the same bars. No alert is sent for signals found during that reload. If your broker corrects old bars, arrows on those bars can change.
Inputs
| Input | Default | Description |
|---|---|---|
| Higher timeframe (must be above the chart's) | Automatic | Automatic, or M15, M30, H1, H4, D1, W1 or MN1. A choice that is not above the chart's timeframe is replaced by the automatic one. |
| Completed candles drawn (1-30) | 6 | How many completed candles are drawn. |
| Line at the forming candle's open | true | The dashed open line. |
| Previous candle's high and low | true | The dotted lines. |
| Name next to the high / low lines | true | PH and PL labels. |
| Minimum sweep, % of the previous candle's range | 0.0 | How far beyond the previous high or low a candle must reach. 0 means any distance. |
| Show sweep arrows | true | Arrows, names and lines for sweeps. |
| Name next to each arrow | true | The sweep name beside each mark. |
| Draw at most this many arrows (newest first) | 60 | Older marks are removed from the chart. |
| Calculate this many bars back (0 = all) | 5000 | 0 = all bars. |
| Status pill (state of the forming candle) | true | The pill at the bottom left. |
| Buy and sell colours | soft tones | Soft mid-tones that read on dark and light charts. |
| Debug log for bug reports | false | See Found a problem? |
| Pop-up alert | true | Alert window in the terminal. |
| Play a sound | false | Plays the sound file below. |
| Sound file | alert.wav | File from the terminal Sounds folder. |
| Push notification | true | Needs your MetaQuotes ID. |
| false | Needs e-mail set up in the terminal options. | |
| Alert: sweep signal | true | Alert for sweeps. |
Alerts and Expert Advisor use
Alerts. One alert per closed bar, sent when the next bar opens. The message names the timeframe, the side and the swept level, for example H4 sweep sell. Nothing is sent while the history loads, twice for the same bar, or in the Strategy Tester.
Buffers for Expert Advisors (iCustom). A buffer holds a price on the bar of a mark and is empty otherwise. The forming bar stays empty. Read from shift 1.
| Buffer | Content |
|---|---|
| 0 / 1 | Sweep buy / sell: the bar's low / high |
| 2 / 3 | Previous candle high / low, as seen from this bar |
| 4 / 5 / 6 / 7 | Open, high, low and close of the higher-timeframe candle so far |
How it was checked
- Candles: the candles built from chart bars equal the platform's own candles. It covered EURUSD, GBPJPY, XAUUSD and BTCUSD on H1, H4, D1, W1 and MN1. 130,519 candles were compared, with 0 differences. That includes the server-midnight D1 and the Sunday W1 boundaries.
- Signals and lines: every buffer, bar by bar, equals an independent Python version of the rules. It covered 80 files (4 symbols, M15, H1, H4 and D1 charts, 5 settings) and 36,749,080 values, with 0 differences. Those files hold 122,208 arrow and mark values.
- Repaint: Strategy Tester runs with every tick (BTCUSD D1, EURUSD H1, EURUSD M15, XAUUSD H4). They checked 19,316 closed bars. 0 values changed after the bar closed, and 0 values were ever shown on the forming bar.
- Error check: Strategy Tester runs on 5 symbol and timeframe pairs, every tick, with 100 and 1,000 USD deposits. That made 10 runs with 0 error lines. Peak memory was 258 MB.
Not tested as a trading rule. I did not test sweeps or changes of delivery as an entry or exit system. The tester runs only check that the indicator calculates the rules correctly and never repaints.
Not tested: alerts on a live chart (the tester is silent for alerts).
Limits
- A sweep is a pattern on completed candles. It does not say that price will reverse.
- The arrow comes when the higher-timeframe candle is complete, so it is late by design. That is the price of not repainting.
- The higher timeframe must be above the chart's timeframe.
- Candles follow the broker's server-time periods. A symbol whose daily session does not start at server midnight can differ from candles you see elsewhere.
- It gives no stop loss, target or lot size.
- The candles depend on your broker's bars. Another broker's history gives slightly different candles and sometimes different sweeps.
- Alerts need the terminal to be running with the chart open.
FAQ
Does it repaint? Arrows, buffers and alerts of a completed candle never change. Only the forming candle changes, and it is drawn dashed and never used for a signal.
Why does the arrow come late? A sweep needs the whole higher-timeframe candle, because its close decides it. The arrow waits for that close.
Which higher timeframe should I use? The automatic choice is a sensible start. Choose H4 or D1 over lower charts if you want a longer view. It must be above the chart's timeframe.
What happens if I change the timeframe or reload the chart? The indicator feeds the closed bars again and draws the same arrows, as long as the inputs and the history are the same. It sends no alerts for old signals.
Why do my candles differ from another platform? Candles follow your broker's bars and server time. Brokers with a different midnight or daily break give different daily candles.
Can an Expert Advisor read it? Yes. Read the buffers listed under Alerts and Expert Advisor use, from shift 1.
Can I run it on a VPS? Yes, like any indicator. It needs a terminal that is running with the chart open. It places no orders.
Is there a MetaTrader 4 version? Yes, HTF Candle Sweep Signals MT4, with the same calculation and buffer numbers.
Try it first
It is free. Attach it to a chart on a demo account, or run it in the Strategy Tester in visual mode on history. Check each arrow against its candle. The history shows where sweeps formed, not what price did next.
Works well with
These are workflow suggestions. I have not found that any pair gives better trading results. You do not need any of them.
| Product | How to use them together | Why |
|---|---|---|
| Session Levels | Add it to the same chart. | It draws session boxes and previous day and week levels as context. It is not a signal. |
| Touch Strength Zones | Add it to the same chart. | Its support and resistance zones sit beside the previous high and low lines. |
| Risk Position Tool | Pick the trade from the chart, then drag the entry and stop lines. | It separates where you enter from how much you risk. The tool places no orders. |
Related products
- HTF Candle Sweep Signals MT4: the same indicator for MetaTrader 4.
- All my products on MQL5
Custom work
Want an EA that trades this indicator, a custom version of it, several of my indicators or EAs combined into one, an EA that trades another indicator you use (mine or another developer's), or a new indicator or EA of your own? Order it through MQL5 Freelance and choose me as the developer: order through Freelance. Send your requirements, rules and the flow or algorithm you want. The whole order, payment and delivery stay inside MQL5 Freelance.
Found a problem?
- In the inputs, set "Debug log for bug reports" to true.
- Repeat what went wrong.
- Open the Experts tab in the Toolbox. Copy the lines that start with "DBG" and paste them in a comment on this page, with the symbol and timeframe.
- Set the debug log back to false.
The debug lines never contain your account number, name, server, balance or equity.
If you find it useful, a short review on this page helps other traders find it.
Questions: use the comments on this page or send me a message on MQL5.
Trading involves risk of loss. Backtest results do not predict future results.
