Alan Ross

Alan Ross Forex

Free Forex Indicators, MetaTrader Tools and Honest Trading Guides

Learn Forex

MQL5 Code Base Indicators in MT5: How to Install Them, and 38 of 159 Settings Made Money, 28 on Gold M15, 1 Passed Every Check

Key takeaways

  • A free indicator from the MQL5 Code Base installs in MT5 in two ways: from the Code Base tab inside the terminal, or by copying the .mq5 file into the MQL5Indicators folder. Both are below, step by step.
  • I then tested 160 input settings of four popular downloads (SuperTrend, HalfTrend, Keltner Channel, QQE) on EURUSD and gold, M5 and M15. 38 of the 159 with enough trades made money after cost, and 28 of those were on gold M15.
  • On EURUSD M5, 0 of 40 settings made money. No input fixed that chart.
  • The setting that looked best in the first half of the data rarely stayed best. SuperTrend 14/3 was first of 16 before July 15 on two charts and last of 16 after it on both.
  • 1 setting of 159 passed every check: HalfTrend with amplitude 6 on EURUSD M15, +0.59 pips a trade over 125 trades.

The MQL5 Code Base is the free, open-source library of indicators and Expert Advisors for MetaTrader. Installing from it takes about a minute. Choosing what to type into the inputs afterwards is the part nobody documents, so this guide does both: the install first, then the numbers.

How do you install an MQL5 Code Base indicator in MT5?

MetaTrader on a laptop, where a Code Base indicator is installed from the Navigator

Way 1: from inside the terminal.

  1. Open the Toolbox with Ctrl+T and click the Code Base tab.
  2. Find the indicator in the list, right-click it and choose Download.
  3. The terminal saves the source file, compiles it and puts it in the Navigator (Ctrl+N) under Indicators, Downloads.
  4. Drag it from the Navigator onto a chart. The inputs window opens. Set the inputs and click OK.

Way 2: from a file you downloaded in the browser.

  1. In MT5 click File, Open Data Folder.
  2. Open the MQL5 folder, then Indicators.
  3. Copy the file there. A file ending in .mq5 is source code. A file ending in .ex5 is already compiled.
  4. Back in MT5, right-click Indicators in the Navigator and choose Refresh. The indicator appears in the list.
  5. If a .mq5 file does not appear, double-click it to open MetaEditor and press F7 to compile. Errors show at the bottom of the editor.

Four things that save time:

  • .mq4 and .ex4 files do not run in MT5. They are MetaTrader 4 files. Many pages offer both versions, so check the extension before you download. The differences between the platforms are in MT4 vs MT5.
  • Code Base is not the Market. The Market tab sells and gives away compiled products. Code Base is always free and always comes with source code.
  • An indicator should not need DLL imports. If one asks for “Allow DLL imports” in its Common tab, leave the box unchecked unless you know why it needs it.
  • Check what the indicator does on the bar that is still forming. The ten-minute test is in how to check if an MT5 indicator repaints.

What was tested?

Typing indicator inputs on a computer before attaching the indicator to a chart
  • Data: EURUSD, June 3 to August 26, 2026, 16,926 M5 bars and 5,642 M15 bars; gold, June 16 to August 26, 13,736 M5 bars and 4,577 M15 bars.
  • Settings: SuperTrend, 4 ATR periods by 4 multipliers; HalfTrend, 6 amplitudes; Keltner Channel, 3 EMA periods by 4 band widths; QQE, 3 RSI periods by 2 factors. 40 settings on each of 4 charts, 160 in all. One had fewer than 30 trades and is left out.
  • Trade: enter at the close of the signal bar, stop 1.5 ATR, target 3 ATR, 48 bars at most, one trade at a time.
  • Cost: a standard 1 pip on EURUSD and $0.30 an ounce on gold, charged on every trade. What that spread means on a 5-minute chart is in my spread and swap measurement.

What each signal is, and how the four did at default inputs, is in free MQL5 indicators tested.

How many settings made money?

IndicatorEURUSD M5EURUSD M15Gold M5Gold M15TotalProfit in both halves
SuperTrend0 of 162 of 164 of 1615 of 1621 of 647
HalfTrend0 of 61 of 63 of 66 of 610 of 246
Keltner Channel0 of 120 of 120 of 125 of 115 of 473
QQE0 of 60 of 60 of 62 of 62 of 240
All four0 of 403 of 407 of 4028 of 3938 of 15916

Settings with a profit after cost. The last column counts those that also made money in each half of the data, split on July 15.

The chart decided far more than the input. On gold M15, 28 of 39 settings made money, almost whatever was typed in. On EURUSD M5, none of 40 did. Of the 16 settings that made money in both halves, 15 were on gold M15.

That is a warning as much as a result. Gold trended through the summer, and random entries with the same stop and target reached +$2.60 to +$4.60 a trade in their best 5% of runs on that chart. None of the 15 gold settings got above that line. They made money the way most things did on gold M15 in those weeks.

Which SuperTrend settings should you use?

The download opens with ATR period 10 and multiplier 3. The period hardly mattered: averaged over the four multipliers, periods 7, 10, 14 and 20 landed within 0.07 pips of each other on EURUSD M5. The multiplier is the input that moves the result.

Multiplier, average of 4 periodsEURUSD M5EURUSD M15Gold M5Gold M15Trades on EURUSD M5
1.5-1.45-1.82-0.82+0.63979
2.0-1.62-0.96-0.72+0.78855
3.0 (default)-1.59-0.06-0.20+1.29610
4.0-1.79-0.25-0.10+1.19422

Per trade after cost: pips on EURUSD, dollars an ounce on gold.

On three of four charts a multiplier of 3 or 4 lost less or made more than 1.5 or 2. A tight line flips more often and each flip pays the spread: on EURUSD M15 the 1.5 multiplier lost 1.82 pips a trade and the default 3 lost 0.06. On EURUSD M5 nothing helped. The default is a sensible place to stay. My earlier grid in SuperTrend settings tested, which traded every flip with no stop, found the same thing about the two inputs: the multiplier decides, the period barely matters.

Which HalfTrend amplitude should you use?

AmplitudeEURUSD M5EURUSD M15Gold M5Gold M15
1-1.38-2.21-0.77+0.75
2 (default)-1.51-1.46+0.07+0.86
3-1.30-0.80+0.47+2.07
4-1.46-0.07+0.02+2.14
6-1.76+0.59-0.37+2.88
10-1.11-0.22-0.87+0.05

On both M15 charts the result improved step by step from amplitude 1 to amplitude 6, then fell at 10. Amplitude 6 on EURUSD M15 is the one setting in this whole guide that passed every check: +0.59 pips a trade over 125 trades, +0.81 in the first half and +0.38 in the second, with the best 5% of random entries at +0.20.

I would hold that loosely. It is 1 pass out of 159 tries, and the same amplitude 6 was the worst HalfTrend setting on EURUSD M5 at -1.76. If you trade HalfTrend on M15, an amplitude of 4 to 6 is a better starting point than the default 2. On M5 no amplitude worked on EURUSD.

Which Keltner Channel and QQE settings worked?

Keltner Channel. Entering on a close outside the channel made money in 5 of 47 settings, all on gold M15. A wider band did not help. With EMA 20, moving the band from 1 ATR to 2.5 ATR took EURUSD M15 from -1.01 to -1.82 pips a trade, because a close outside a wide band comes even later in the move. The steadiest cell was EMA 10 with a 1.5 ATR band on gold M15: +$1.83 a trade, +1.89 and +1.80 in the two halves, still under the random line of +$2.98. The channel is more useful as a picture of volatility than as a breakout trigger, which is how it came out against Bollinger Bands in ATR channel vs Bollinger Bands.

QQE. RSI periods 7, 14 and 21 with factors 2.618 and 4.236 gave 24 runs. Two made money, both on gold M15, and neither in both halves. On EURUSD M5 the six settings sat between -1.19 and -1.40 pips a trade. Leave it at the default 14 and 4.236 and treat it as a momentum display.

Does the best setting stay the best?

This is the question behind every optimisation. For each indicator on each chart I took the setting with the best result before July 15 and looked at what it did after.

Indicator and chartBest setting, 1st half1st half2nd halfRank in 2nd half
SuperTrend, EURUSD M514 / 3-1.15-1.9816 of 16
SuperTrend, gold M1514 / 3+6.05-1.7316 of 16
SuperTrend, gold M520 / 4-0.68+0.695 of 16
Keltner, gold M1550 / 1.5+7.77-0.845 of 11
Keltner, EURUSD M510 / 2.5-0.23-1.464 of 12
HalfTrend, gold M156+5.93+1.541 of 6
HalfTrend, EURUSD M156+0.81+0.381 of 6
QQE, gold M1514 / 2.618-0.24+0.793 of 6

Eight of the 16 cases. The other eight are in the same range.

Across all 16 cases, the first-half winner made money in the second half in 5 and was still ranked first in 3. All three were HalfTrend. The two SuperTrend rows at the top are the ones to remember: on gold M15, period 14 with multiplier 3 made $6.05 a trade before July 15, the best of 16 settings, and lost $1.73 after it, the worst of 16.

The data is short: twelve weeks of EURUSD, so six weeks in each half, and ten weeks of gold, with only four before July 15. A longer history would give a fairer split. What the table already shows is how much a single best cell can move, and that is the reason I test whole grids. The same effect on Expert Advisors is measured in EA optimization in and out of sample.

What settings to start with

  • SuperTrend: keep 10 and 3. Do not tighten the multiplier below 3 to get more signals. The period is not worth tuning.
  • HalfTrend: on M15 try amplitude 4 to 6 instead of 2. On M5 leave it as a trend display.
  • Keltner Channel: keep EMA 20 and 2 ATR for reading volatility. Do not trade the close outside the band as an entry.
  • QQE: keep 14, 5 and 4.236.
  • Look at the chart before the inputs: all 38 profitable settings but 7 were on M15, and 28 were on one chart. At default inputs the step from M5 to M15 was bigger than noise for one indicator of four, SuperTrend on EURUSD, so read that as a tendency and not a rule.
  • Test on a demo account before real money, and for longer than a good week. How long is enough is in how long to demo trade.

Frequently asked questions

Where do I put MQL5 indicator files in MT5?

In the MQL5Indicators folder inside the data folder. Open it with File, Open Data Folder, copy the .mq5 or .ex5 file there, then right-click Indicators in the Navigator and choose Refresh.

Why does my downloaded indicator not show in the Navigator?

The usual causes are a MetaTrader 4 file (.mq4 or .ex4) in an MT5 terminal, a file placed in the wrong folder, or source code that did not compile. Open the .mq5 file in MetaEditor and press F7 to see the errors.

Are indicators from the MQL5 Code Base free?

Yes. Everything in the Code Base is free and comes with source code. Paid products are in the Market, which is a separate tab.

What are the best SuperTrend settings for MT5?

In this test the default 10 and 3 was as good as anything. The ATR period made almost no difference, and multipliers of 3 and 4 beat 1.5 and 2 on three of four charts.

Which setting passed every check?

One of 159: HalfTrend with amplitude 6 on EURUSD M15, +0.59 pips a trade over 125 trades, positive in both halves and above the best 5% of random entries.

Want a clean indicator to install right now?

It is my own enhanced DeMARK Trend Line indicator for MetaTrader 4 and 5. Non repaint, clean, and free.

Download the Free DeMARK Indicator

Written by Alan Ross

Forex trader and MetaTrader indicator developer. I build and test MT4 and MT5 tools, then write the honest version of how they actually work. More about me.

Last reviewed October 2026
Alan Ross
Alan Ross

Forex educator and indicator developer. I build and trade my own MetaTrader tools, and share the ones that genuinely help.

Leave a comment

Your email address will not be published. Comments are reviewed before they appear.