Libreria di Codici Sorgente MQL4 e MQL5

icon

Vuoi imparare il linguaggio di programmazione MQL5 o MQL4, ma non sai da dove cominciare? Qui sono disponibili vari programmi per il tuo terminale MetaTrader. Scarica e studia questi esempi di codici pubblicati e sviluppa per conto tuo degli indicatori e degli Expert Advisor. Le tue applicazioni pubblicate nella più grande libreria di codici MQL5 e MQL4 saranno disponibili in ogni terminale MetaTrader e nel MetaEditor.

I tuoi esempi di codice in MQL4 e MQL5 saranno distribuiti in tutto il mondo, permettendoti di entrare in contatto con migliaia di trader!

Invia il tuo codice

Indicatore iFVG con segnali

ZoneUS30 è un semplice Expert Advisor per l'indice US30 incentrato sulle opportunità di VENDITA a seguito di estensioni al rialzo dei prezzi. La strategia combina il concetto di ritorno alla media con l'idea del carry trade: quando le posizioni corte generano uno swap overnight positivo, l'EA può trarre vantaggio sia dalla correzione dei prezzi sia dal mantenimento della posizione nel tempo. Progettato per l'indice US30 e destinato a uso sperimentale e didattico. Il trading in controtendenza comporta rischi significativi, specialmente con lotti di grandi dimensioni.

Fits five bivariate copulas on ranks, with Kendall's tau, tail dependence, the probability of joint extreme days, AIC and the conditional probabilities of pairs trading.

Online detection of changes in the mean or volatility (Adams-MacKay): probability of a change in the last k bars, current segment length, forecast, and an indicator.

Exact maximum likelihood of an Ornstein-Uhlenbeck spread and Bertram's optimal entry and exit levels for a given cost, with the expected length of a trade cycle.

For every closed position the script measures how far the price went against it (MAE) and in its favour (MFE), and shows what that says about your stops and exits. Table, summary on the chart and a CSV file. Read-only, it never trades.

A table on the chart: the typical spread of the symbol for every hour and weekday, read from the history of your broker. Green is cheap, red is expensive. Hours in server time, UTC or a city with the right summer time. Read-only.

EURUSD EA that trades both directions: when the Awesome Oscillator turns against a weighted moving average filter, it places a stop order at the daily low or high of three days ago, with an ATR stop. Self-contained, no custom indicators. Backtest on EURUSD H1, October 2021 to October 2026: +209% on a 1,000 USD deposit with a fixed 20 USD risk per trade, 15.55% maximum equity drawdown.

A lightweight tab bar for chart panels, drawn with the standard CCanvas class. One include file, several independent instances per chart, click selection, resizing and safe cleanup. Includes a demo Expert Advisor.

Candle countdown timer for Gold (XAUUSD), EURUSD and any symbol: time left on the current candle next to price or in a corner, spread, color change and alert before the close. Server time, no ticks needed. Open source code.

Un piccolo Expert Advisor dimostrativo: entrate basate sull’incrocio tra EMA veloce e lenta (valutate solo su barre chiuse, senza repainting), stop-loss e take-profit basati sull’ATR, filtro dello spread e gestione delle posizioni compatibile sia con conti di copertura che con conti di compensazione. Include un’implementazione di riferimento in Python per il test di parità. Si tratta di un esempio illustrativo, non di una raccomandazione di trading: la curva di capitale allegata è basata su dati sintetici e illustra il metodo, non un vantaggio competitivo.

Expert Advisor open source per la coppia EURUSD per lo Strategy Tester di MetaTrader 5, basato su segnali di esaurimento dell'RSI, uscite basate sull'ATR e filtraggio dello spread adeguato alla volatilità.

Draws Asia, London and New York session boxes on the chart with each session's high and low.

Closes all open positions and optionally deletes pending orders with one click. Filter by symbol and magic number.

Parkinson, Garman-Klass, Rogers-Satchell and Yang-Zhang estimators, daily realized and bipower variance from intraday bars, and HAR volatility forecasts.

Five tests to tell a random walk from a mean-reverting series: KPSS, Phillips-Perron, DF-GLS, Zivot-Andrews with the break date, and the variance ratio.

Drag the stop-loss line and read the lot size that risks exactly your money or percent. The CRiskSizer class does the same in an EA: lot rounded down, minimum lot never forced, max lot, volume limit, stop level and margin checked.

CBrokerTime converts server time, UTC, New York, London, Sydney and Tokyo with the real summer time of every year and finds your broker's clock from the history (also in the tester). The indicator draws session lines and a clock panel.

A clean Heikin Ashi indicator that draws on the main chart window. It also adds one horizontal line at the average price, (Open + High + Low + Close) / 4, of the last closed candle of a chosen timeframe. By default this is H1, and the line uses the normal candles, not Heikin Ashi.

Individua i gap del CME del fine settimana sui grafici dell'oro e su quelli del Bitcoin 24/7, mantiene ogni gap non colmato sul grafico fino a quando il prezzo non vi ritorna, e mostra con quale frequenza i gap vengono colmati, con quale rapidità, di quanto si è spostato inizialmente il prezzo e quale profitto si sarebbe ottenuto chiudendo le posizioni. Non si aggiorna automaticamente, con buffer per un Expert Advisor.

Un EA di breakout in stile Turtle per l'oro. Effettua acquisti quando una candela H4 chiude al di sopra del massimo delle ultime 20 candele in un trend rialzista, con uno stop di 2 ATR e un obiettivo di 2R. Backtest effettuato su XAUUSD da gennaio 2020 a settembre 2026: +9.029,72 su un capitale iniziale di 10.000 con un rischio dell’1%, fattore di profitto 1,77, drawdown massimo dell’11,38%, 6 anni su 7 in profitto.

Market structure indicator for Gold (XAUUSD), EURUSD and any symbol: swing highs and lows with HH HL LH LL labels, BOS and CHoCH drawn on closed candles, alerts and 4 buffers for EAs. Open source code.

Pannello di trading manuale trascinabile sul grafico con analisi su più timeframe, suggerimenti ATR per SL/TP, trailing stop e comandi "ACQUISTA/VENDI/CHIUDI TUTTO" con un solo clic.

Sistema di protezione a livello di conto per i conti delle società di prop trading. Monitora ogni posizione sul conto, chiude tutte le posizioni al raggiungimento del limite di perdita giornaliero o massimo, limita l’importo a rischio per ciascuna posizione, chiude le operazioni prive di stop e può azzerare le posizioni in caso di notizie ad alto impatto.

Segna le candele di impulso: corpo pari ad almeno ATR × moltiplicatore, corpo pari ad almeno una percentuale prestabilita dell'intervallo della candela, chiusura vicina all'estremo, conferma opzionale del volume dei tick. Freccia verde sotto un impulso rialzista, rossa sopra uno ribassista. Solo barre chiuse, nessun repainting. I segnali sono contenuti nei due buffer in modo che un Expert Advisor possa leggerli tramite iCustom.

Expert Advisor per MetaTrader 5 basato sul trend-following che combina la direzione del Supertrend con la conferma fornita dall'ADX e dai DI. Utilizza uno stop loss basato sull'ATR e assume un rischio massimo dello 0,5% del capitale per ogni operazione.

Tick Scalper Helper is a manual trading utility for traders who work on very short time frames and want to see every price change.

A Supertrend scalping EA with 14 switchable filters and a self-measuring panel that shows the actual win rate next to the win rate needed to break even after real spread, so you can see whether a setting has an edge or only a high percentage.

Range boxes that are drawn when market trend strength weakens

Detects the broker's GMT offset and its daylight-time rule (fixed, US or European) from the weekly closes in the H1 history, the same way live and in the Strategy Tester, with functions that convert New York times to server time and back.

Partial close expert advisor for MetaTrader 5: closes a percent of the position at TP1, TP2, TP3, TP4 and TP5, moves the stop loss to breakeven and trails it. Works on manual trades and on positions of any EA, on any symbol, Gold (XAUUSD) included. Open source code.

Shows the broker's hidden financing markup and the carry for every symbol, as annual % of notional.

Is the best of many strategies really better than the benchmark? Hansen's SPA test, White's Reality Check, Romano-Wolf StepM and the model confidence set.

Breakout secondo il metodo Donchian in stile Turtle sull'oro, seguiti da tre uscite contemporanee: uno stop trailing basato sull'ATR, il canale di uscita Turtle e un obiettivo fisso. Testato retrospettivamente su XAUUSD H1 e H4 nel 2025 e nel 2026, dove tutte e dodici le combinazioni si sono rivelate redditizie. Senza ripainting, con buffer per un Expert Advisor.

Segna i massimi e i minimi di oscillazione solo dopo che le barre chiuse con N li hanno confermati, quindi un’oscillazione tracciata non si sposta né scompare mai.

Position manager for MT5 that closes the best winner together with the worst loser when their combined result reaches your minimum. Basket take profit and stop loss in money, magic filter, simple panel. Works with grid, martingale and manual trades. Open source code.

Unit root and cointegration tests (ADF, Engle-Granger, Johansen) with MacKinnon p-values, hedge ratio, half-life and z-score of the spread, and a pair scanner.

Kalman filter and smoother with an exact diffuse start, missing values and maximum likelihood: local level, local linear trend and a regression whose hedge ratio drifts.

Gaussian hidden Markov model fitted by Baum-Welch: regime probabilities without look-ahead, most likely path, expected durations and regime forecasts.

Holidays and early halts of the CME equity index futures (S&P 500, Nasdaq-100, Dow, Russell 2000, E-mini and Micro), computed from the US holiday rules for any year, with a script that checks the calendar against your broker's own M1 history.