Camovia Tray™

Blog · Roundups

How to Use Forex Fractals Indicator with MQL4 Language

Camovia Tray Team · 2026-09-12

Have you ever stared at your MetaTrader 4 chart, watching price hover near a recent high, and wondered: is this a genuine reversal point or just noise? This is precisely the question that drives many traders to the Fractals indicator—a tool introduced by Bill Williams to identify potential turning points in the market .

But knowing how to read fractals on a chart is only half the battle. The real edge comes when you can code them into your own Expert Advisors or custom indicators using MQL4. If you've been searching for a practical guide on using the Forex Fractals indicator with MQL4, this is where we get hands-on.

Understanding the Fractals Indicator

The Fractals indicator is a straightforward concept with powerful implications. It pinpoints specific candlestick patterns that suggest a potential reversal. In MetaTrader 4, the indicator is fixed to a radius of 2, meaning it looks for a candle with the highest high (or lowest low) compared to the two candles on either side .

Think of it like a tiny five-candle mountain. If you see a peak where the middle candle's high is higher than the two before it and the two after it, you have an "Up Fractal" (bearish signal). Conversely, a valley where the middle candle's low is lower than its neighbors is a "Down Fractal" (bullish signal) .

Using iFractals in Your MQL4 Code

To use fractals programmatically in MQL4, you'll rely on a single, essential function: iFractals(). This function pulls the indicator's values directly from your chart's data.

The structure is simpler than you might think:

double iFractals(
   string symbol,      // Symbol name (NULL for current)
   int timeframe,      // Timeframe (0 for current)
   int mode,           // MODE_UPPER or MODE_LOWER
   int shift           // Bar index (0 = current bar)
);

Breaking Down the Parameters

First, you decide which symbol and timeframe you're working with. If you're coding an Expert Advisor for the active chart, passing NULL for the symbol and 0 for the timeframe will do the trick .

The mode parameter is your key to identifying the type of fractal:

  • MODE_UPPER checks for a sell fractal (the bullish peak)
  • MODE_LOWER checks for a buy fractal (the bearish valley)

When a fractal is present at a specific bar, iFractals() returns the price level (high for MODE_UPPER, low for MODE_LOWER). When no fractal exists, it returns 0 .

A Simple Practical Example

Imagine you want to detect whether an Up Fractal formed on the previous completed bar. Your code would look something like this:

double fractalValue = iFractals(NULL, 0, MODE_UPPER, 2);

if(fractalValue > 0) {
   // An Up Fractal exists at the bar with shift 2
   // You could now implement logic: avoid buying, consider selling
}

Many traders use this in loops to scan for the most recent fractals. You could loop through the last several bars to find the latest fractal, or check for confluence—when multiple fractals align across timeframes .

A Common Pitfall and How to Avoid It

One thing to be careful about with fractals is repainting. An official fractal is only confirmed after the "right side" bars are completed. While the built-in iFractals() function handles the historical part correctly, remember that on the current (uncompleted) bar, the signal isn't final. Some custom indicators add non-repainting confirmation logic to avoid false signals in real-time trading .

Where Camovia Tray Fits into Your Workflow

You've built a solid fractal detection logic in MQL4. You're backtesting it, tweaking the parameters, and maybe even deploying it as an EA. But here's a practical challenge that often gets overlooked: your workflow.

When you're deeply focused on coding and testing in MetaEditor and MetaTrader, the terminal window has to stay open. You need to see the chart, monitor the logs, and watch your EA in action. But when you need to step away, check a different system, or simply declutter your workspace, closing MT4 means losing that real-time awareness. Leaving it open on your desktop isn't always convenient or private.

This is where Camovia Tray offers a simple solution. It transforms your MT4/MT5 terminal into a system tray tool. Instead of keeping the full MT4 window occupying screen space or visible in your taskbar, you can hide it completely [citation:Product Knowledge].

When your EA is running and you want to keep an eye on the latest price action or your open positions without pulling up the entire MT4 interface, you can simply hover your mouse over the Camovia Tray icon. It displays real-time quotes for your selected symbols [citation:Product Knowledge]. If you're running a fractal-based EA, you can check whether new fractals might have triggered trades and monitor your open positions directly from the tray, including a quick view of current P&L [citation:Product Knowledge].

The data is read directly from your local terminal and stays on your computer, so your privacy is maintained—no external servers involved [citation:Product Knowledge]. It's a practical way to stay connected to your trading environment while keeping your desktop clean and your activities discreet.

Final Thoughts

Coding the Fractals indicator in MQL4 gives you a systematic way to identify reversal levels without second-guessing. By mastering the iFractals() function and understanding its limitations, you can build more robust EAs and custom indicators.

And remember, while you're perfecting that logic, tools like Camovia Tray can make your day-to-day workflow just a little bit smoother—so you can focus on what matters: the trade.

Turn MT5 / MT4 into a Tray Tool

Check quotes, manage positions, and hide in one click.

Download Camovia Tray

Frequently Asked Questions

Do I need MT5/MT4 installed? Does the terminal need to stay open?

Yes. Camovia Tray reads quote and position data from your locally running MT5/MT4 terminal, so the terminal must be installed, running, and logged in. MT5 connects directly with no EA; MT4 needs the bundled bridge EA attached once (one-click copy in Settings, then double-click in the Navigator - see the docs).

Are my quotes and positions uploaded anywhere?

No. Quote and position data is read 100% from your local MT5/MT4 terminal and never leaves your computer. See the privacy policy for details.

Which systems and terminals are supported?

Windows 10 / 11, with MetaTrader 5 or MetaTrader 4 (installed and logged in; MT4 needs the bridge EA attached once).

Is the MT4 bridge EA safe? What do I need to enable?

Yes. The bridge EA (CamoviaBridge) is bundled with the app - it only reads quotes/positions locally and executes close commands; no DLLs, no data uploads. Closing positions requires turning on AutoTrading in the MT4 toolbar.

Popular Symbols Trading Hours

Open/close times, weekend hours & live market status: