Complete User Guide — Cycle Detection, Entry System, Magic Line Targets, Scanner, Helper & Alerts
MetaTrader 5 Indicator • Version 5.6
✨ v5.6 — Improved scanner alerts, trade helper scores, performance updates & bug fixes
Magic Lines v5 is a complete BTMM (Beat The Market Maker) trading system for MetaTrader 5, rebuilt from scratch with clean code and enhanced features.
Volume-weighted 6-colour HA candles. Dark red/Red/Orange for bears, Dark blue/Blue/Light blue for bulls. Volume intensity shows conviction.
Volume Weighted Average Price that auto-adjusts its anchor period based on your chart timeframe. Daily on M1-M15, Weekly on M30-H1, Monthly on H1-H4.
Colour-coded trend line — blue when price is above (bullish), red when below (bearish). The key level for cycle detection alongside VWAP.
Large (150/24), Medium (34/6), and Small (14/3) ZigZag levels shown as semafor dots. Visual reference only — not used in signal logic.
Entry at HA midpoint with ADR-based SL and Magic Line TP targets. Each label shows pip distance, R:R ratio, and partial close suggestions.
9-column live scanner showing cycle direction, ADR%, EMA touch status, re-entry signals, and confluence score across up to 8 pairs.
Getting Magic Lines v5 running on your MetaTrader 5 charts.
G_Labs_Magic_Lines_v5.mq5 into your MT5 MQL5\Indicators\ folder.The Scanner Pairs input accepts comma-separated symbols: EURUSD,GBPUSD,USDJPY,AUDUSD,USDCAD,NZDUSD,USDCHF,EURGBP. If your broker uses suffixes (e.g. EURUSD.m), the indicator auto-detects them.
How v5 identifies bull and bear cycles — the foundation of the entire entry system.
A clean bearish HA candle has its entire body below BOTH the VWAP and the EMA 62, with no upper wick (haHigh equals haOpen). This means sellers completely dominated with zero retracement.
A clean bullish HA candle is the mirror — entire body above both lines, no lower wick.
When 2 consecutive clean bearish HA candles appear below both VWAP and EMA, after price was previously bullish or neutral, the indicator records the highest high reached during the previous bull run as the APH level. A SELL cycle begins.
When 2 consecutive clean bullish HA candles appear above both VWAP and EMA, after price was previously bearish or neutral, the indicator records the lowest low as the APL level. A BUY cycle begins.
A single clean candle can be noise. Two consecutive candles on the same side of both VWAP and EMA confirms a genuine shift in market structure. The NOT isTCls[2] condition ensures we only fire once at the transition, not on every subsequent candle.
When a cycle change fires, the full entry system draws automatically on the chart.
The entry is placed at the HA candle midpoint: (haOpen + haClose) / 2. This is more reliable than the close price because it represents the average commitment level of that candle.
| Line | Colour | Description |
|---|---|---|
| Entry | Gold | HA midpoint + BUY/SELL label + signal quality (STRONG/WEAK based on volume) |
| APH / APL | Blue / Red | Structural level (highest high or lowest low of previous cycle) + age in days |
| Stop Loss | Red | Entry ± ADR × SL Multiplier, with pip distance label |
| TP1 (ML 1) | Green | Entry ± 1×ADR — "TP1 (50%) | XXp | 1:X.X" |
| TP2 (ML 2) | Bright Green | Entry ± 2×ADR — "TP2 (30%) | XXp | 1:X.X" |
| TP3 (ML 3) | Gold | Entry ± 3×ADR — "TP3 (20%) | XXp | 1:X.X" |
| Breakeven | Grey dotted | Appears at entry price when TP1 is hit — "BE (move SL here)" |
Each entry is rated based on volume at the trigger candle:
Close 50% at TP1, move SL to breakeven. Close 30% at TP2, move SL to ML1. Let the remaining 20% run to TP3. This locks in profit while allowing for extension moves.
Magic Lines are not traditional support/resistance. They are ADR-projected price targets measured from the entry. The ADR (Average Daily Range) is calculated over the last 15 days by default. If a pair's ADR is 80 pips, then ML1 is 80 pips from entry, ML2 is 160 pips, ML3 is 240 pips. This scales dynamically with volatility.
The core concept that gives the indicator its name.
Magic Lines are ADR-based take-profit targets projected from the entry price when a new cycle starts. They represent where price is statistically likely to reach based on average daily volatility.
| Input | Default | Purpose |
|---|---|---|
| ADR Period | 15 | Number of days used to calculate average daily range |
| ADR Multiplier (TP) | 1.0 | Scales target distances. Set to 0.8 for tighter targets, 1.2 for wider |
| ADR Multiplier (SL) | 1.0 | Scales stop loss distance. Set to 0.5 for tighter stops |
| Number of Lines | 4 | Total lines: 1 SL + (N-1) ML targets. Default = 1 SL + 3 TPs |
| Line Extension | 150 | How far right (in bars) the lines extend |
Catching the second (and third) wave within an existing cycle.
After an APL or APH sets the cycle direction, price may retrace before continuing. The re-entry system catches these pullbacks:
Re-entry lines and labels are automatically cleared when a new cycle starts (new APH or APL). Each cycle tracks its own re-entry count from zero.
Live dashboard showing the state of up to 8 pairs at a glance.
| PAIR | DIR | HTF | ADR% | EMA | RE | CF | ADR | RNG |
|---|---|---|---|---|---|---|---|---|
| EURUSD | BUY | BULL | 42% | YES | - | 4 | 78 | 33 |
| GBPUSD | SEL | BEAR | 81% | - | SEL | 3 | 112 | 91 |
| USDJPY | BUY | BULL | 67% | - | - | 2 | 95 | 64 |
| Column | What It Shows |
|---|---|
| PAIR | Symbol name (click to switch chart). Current chart pair is highlighted in orange. |
| DIR | Current cycle direction: BUY or SEL |
| HTF | Higher timeframe bias (default H1): BULL / BEAR |
| ADR% | Today's range as % of the average daily range. White <50%, Blue <75%, Orange <100%, Red ≥100% (extended) |
| EMA | YES if price is touching the EMA 62 zone, – otherwise |
| RE | Re-entry signal active: BUY / SEL or – if none |
| CF | Scanner confluence score 0–5 (see below). 4–5 = Strong, 3 = Moderate, 2 = Building |
| ADR | Average Daily Range in pips for that pair |
| RNG | Today's actual range so far in pips |
The CF column scores each pair from 0 to 5. Each of the following conditions adds one point:
| Condition Checked | Points |
|---|---|
| Current direction (DIR) matches the higher timeframe bias (HTF) — aligned trend | +1 |
| Price is on the correct side of VWAP for the current cycle direction | +1 |
| EMA touch is active (price near the EMA — potential pullback entry zone) | +1 |
| Less than 75% of the average daily range has been used (room to move) | +1 |
| A re-entry signal is active in the direction of the cycle | +1 |
The scanner CF column and the Trade Helper Confluence score are two separate calculations. The scanner CF gives a quick overview for pairs you are not on the chart with. The Trade Helper confluence is more detailed and also factors in Magic Line proximity using full chart data. Use the scanner to shortlist pairs, then open the chart and check the helper for a deeper read.
The scanner loads instantly when the indicator is added to a chart — no waiting. Data refreshes every 2.5 seconds. It uses lightweight calculations per pair to keep CPU usage minimal even with 8 pairs running.
Real-time trade assistant in the bottom-left corner of your chart. Updates every 2.5 seconds with live market data.
| Field | Description |
|---|---|
| Cycle | Current confirmed cycle: BULL (APL), BEAR (APH), or FLAT |
| VWAP Dist | Distance from VWAP in pips. Positive = above (blue), Negative = below (red) |
| EMA Dist | Distance from EMA 62 in pips. Green when within 15 pips (touch zone) |
| ADR Used | Percentage of the average daily range already used today |
| Nearest ML | Distance in pips to the closest Magic Line target. Orange when within 20 pips |
| Quality | Signal quality rating in stars (1–5) — see full breakdown below |
| Trail SL | Suggested stop management action based on which TP levels have been hit |
| Confluence | Live score out of 5 based on current market conditions — see full breakdown below |
| Action | Trading suggestion based on the confluence score |
| Warning | Caution message when conditions are unfavourable |
Rates the strength of the entry signal at the moment it fired. This score is fixed until a new entry triggers — it does not change as the market moves.
| Condition at Time of Entry | Points |
|---|---|
| Entry volume was significantly above average — strong market participation | +2 ⭐⭐ |
| Entry volume was at a normal level | +1 ⭐ |
| Less than 70% of the average daily range had been used | +1 ⭐ |
| Price was within 30 pips of VWAP when the entry fired | +1 ⭐ |
| A confirmed cycle direction (BULL or BEAR) was active | +1 ⭐ |
A 5-star entry means the signal fired with high volume, early in the day, close to VWAP, with a confirmed cycle — all conditions aligned. A 1–2 star entry should be treated with caution.
A live reading of current market conditions that updates every 2.5 seconds. Unlike the quality stars, this changes as price moves.
| Current Condition | Points |
|---|---|
| Cycle is confirmed as BULL or BEAR (not flat) | +1 |
| Price is on the correct side of VWAP for the current cycle direction | +1 |
| Price is near the EMA 62 (within 20 pips) | +1 |
| Less than 80% of the average daily range has been used today | +1 |
| Price is within 30 pips of the nearest Magic Line target | +1 |
| Score | Action Label | What to Do |
|---|---|---|
| 4 – 5 | STRONG BUY / STRONG SELL | All factors aligned — high conviction setup |
| 3 | WATCH ENTRY | Setup is building — stay alert, don't rush in |
| 2 | BUILDING... | Too early — wait for more factors to align |
| 0 – 1 | NO SETUP | Conditions not favourable — stay out |
| Message | Meaning |
|---|---|
| SL at original level | TP1 not yet hit — keep your stop where it was placed |
| Move SL to Breakeven | TP1 has been hit — move stop to your entry price |
| Move SL to ML1 | TP2 has been hit — trail stop up to the TP1 level |
| No active trade | No entry is currently active on this pair |
| Warning | What It Means |
|---|---|
| ADR EXHAUSTED — NO ENTRIES | Over 90% of the daily range has been used. Very high risk of reversal — avoid new entries |
| ADR 75%+ caution | Getting extended. Be cautious and wait for a pullback before entering |
| EMA touch zone! | Price is very close to the EMA 62 — watch for a reaction at this level |
| Wait for clean setup | No specific concern but conditions are not ideal — patience required |
Never miss a cycle change, re-entry, or VWAP cross — on your chart pair or any pair in the scanner.
| Alert Message | Fires When |
|---|---|
| Buy Entry (APL) at ... | New bull cycle starts — entry price included in the message |
| Sell Entry (APH) at ... | New bear cycle starts — entry price included in the message |
| Bull Re-Entry Entry #N | Re-entry signal in a bull cycle — number counts up per cycle |
| Bear Re-Entry Entry #N | Re-entry signal in a bear cycle |
| VWAP Cross UP | Price closes above VWAP after being below |
| VWAP Cross DOWN | Price closes below VWAP after being above |
Every alert follows a consistent format so you always know exactly what fired and where:
With Scanner Alerts enabled, every pair in your scanner list can fire the same alert types — not just the pair on your chart. Each pair is checked independently and has its own deduplication, so one pair firing does not affect others. Scanner alerts continue to work even when the scanner panel is hidden.
Each alert type tracks the last bar it fired on per symbol. The same alert will not fire twice on the same bar, preventing spam during fast-moving markets. Deduplication resets cleanly when the indicator is reloaded.
Thin dotted vertical lines mark session open and close times.
| Session | Default Times | Colour |
|---|---|---|
| London | 08:00 – 17:00 (server time) | Dark green |
| New York | 13:00 – 22:00 | Dark orange |
| Asian | 00:00 – 09:00 | Dark purple |
Session markers use vertical dotted lines instead of filled rectangles. This keeps the chart clean and doesn't obscure price action. Adjust session times in the inputs to match your broker's server timezone.
Common questions about Magic Lines v5.
Entry lines only appear after a cycle change (APH or APL) has fired. If the market hasn't had a clear transition with 2 clean HA candles crossing both VWAP and EMA, no entry will trigger. Try a lower timeframe (M5/M15) for more frequent signals.
Magic Lines are forward-projected targets based on ADR, not historical support/resistance. They represent where price is likely to travel based on average volatility, measured from the entry point. Think of them as statistical price targets.
The VWAP resets at different intervals depending on your chart timeframe: Daily for M1-M15, Weekly for M30-H1, Monthly for H1-H4. This ensures VWAP is always relevant to the timeframe you're analysing.
The "clean candle" requirement is strict by design — it filters out noise. To get more signals, lower your chart timeframe. The ADR multipliers control target/SL distances but not signal frequency.
The scanner uses a simplified cycle detection (close vs EMA) for remote pairs, while the chart uses the full HA + VWAP + EMA system. This is by design for performance — running full calculations across 8 pairs would be too heavy.
Quality Stars are fixed at the moment an entry fires — they rate how good that specific signal was at that point in time (volume, ADR space, VWAP position). The Confluence Score is live and updates continuously, showing how well current market conditions support a new entry right now. Use both together: a high-star signal that still shows strong confluence is the ideal scenario.
Signals only fire on confirmed bars (when the clean candle conditions are fully met). The ZigZag semafor dots are visual reference only and do not affect signals. Entry lines are drawn at the point of signal confirmation and do not move.