Libreria di Codici Sorgente MQL5 per MetaTrader 5 - 17

icon

Questa è la più grande libreria di codici sorgente gratuiti per i programmi della piattaforma MetaTrader 5. Qui puoi trovare Expert Advisors, indicatori tecnici, script e librerie pronti all'uso. Sfrutta la libreria di codici per imparare il linguaggio MQL5 e sviluppa le tue applicazioni di trading automatico partendo dai codici disponibili.

I codici possono essere liberamente scaricati, testati e lanciati in MetaTrader 5. La libreria è anche disponibile direttamente dalla piattaforma MetaTrader 5 e dall'ambiente di sviluppo MetaEditor.

Invia il tuo codice

Crea un profilo di volume mobile e adattivo alla volatilità su una finestra di analisi storica configurabile e traccia il Punto di Controllo (POC), i massimi e minimi dell'Area di Valore e i nodi di volume massimo e minimo statisticamente significativi (HVN/LVN) direttamente sul grafico.

Monitora la correlazione mobile tra il simbolo del grafico corrente e un simbolo di riferimento prescelto, e segnala il momento in cui i due simboli si disaccoppiano mentre il loro differenziale di prezzo è statisticamente ampio.

Indicatore MT5 di sola lettura che visualizza sul grafico i valori di riferimento dei livelli di stop e di congelamento del broker.

Monitor degli spread professionale open source per MetaTrader 5. Visualizza lo spread in tempo reale, lo spread minimo, massimo e medio, il grafico storico e gli avvisi configurabili in caso di spread elevati, il tutto tramite una moderna dashboard Quantora.

Calcolatore professionale open source dei costi di trading per MetaTrader 5. Calcola il costo dello spread, la commissione, lo swap e il costo totale stimato delle operazioni utilizzando i dati in tempo reale dei simboli dei broker e impostazioni di posizione personalizzabili.

Traccia un oscillatore ponderato in base al volume e normalizzato in base alla volatilità che segnala condizioni di impulso e di esaurimento man mano che il prezzo si allontana dal proprio VWAP mobile

Un filtro di Kalman a stato singolo che ridimensiona il proprio rumore di processo in base al rapporto di efficienza di Kaufman ad ogni barra, allineandosi maggiormente al prezzo durante i trend e smussando con maggiore intensità nei periodi di volatilità, rappresentato graficamente con bande di regime che si espandono e si contraggono sulla stessa lettura

Sfondo con grafico BMP per MT5

Una media mobile adattiva a due stadi (media di base + livellamento secondario) che cambia colore in base alla pendenza e segna con delle frecce i punti di incrocio tra prezzo e media.

Visualizza i limiti nascosti del contratto che causano il rifiuto silenzioso degli ordini: livello di stop, livello di congelamento, lotto minimo/incremento/massimo, dimensione e valore del tick, tipo di spread, modalità di esecuzione, swap e il margine necessario per il lotto minimo rispetto al margine libero.

Un Expert Advisor che misura il massimo e il minimo di una finestra di apertura di sessione definita, per poi effettuare operazioni in seguito alla conferma della rottura di tale intervallo, con un dimensionamento delle posizioni basato sul rischio e un limite massimo di un’operazione per sessione.

Reverse RSI Bands è un indicatore anticipatore che rielabora matematicamente la formula dell'RSI. Traccia precise fasce di prezzo target direttamente sul grafico principale, indicando in tempo reale a quale prezzo esattamente l'RSI raggiungerà i livelli di ipercomprato o ipervenduto da te specificati.

Utilità di cronologia MT5 in sola lettura che raggruppa le esecuzioni parziali in base all'identificativo della posizione e separa il risultato lordo da commissioni, swap, spese e risultato netto.

Strumento di analisi delle sessioni di trading nativo del broker, in sola lettura, con visualizzazione dello stato attuale, della transizione successiva, con ambito multi-simbolo ed esportazione in formato CSV.

Script MT5 di sola lettura che riporta il volume, il prezzo, gli stop, il congelamento, lo spread e i vincoli di esecuzione del broker.

"Segna i massimi e i minimi della sessione precedente e segnala i movimenti di liquidità che tornano all'interno dell'intervallo entro un numero prestabilito di barre." — categoria "Altro", oppure "Trend" se preferisci raggrupparlo in questo modo.

News Trading Dashboard è un pannello informativo integrato nel grafico (che non effettua operazioni automaticamente) che monitora la volatilità del mercato in tempo reale per individuare i momenti di “picco dovuto alle notizie”, ovvero gli sbalzi improvvisi dei prezzi che si verificano in occasione della pubblicazione di dati economici (NFP, CPI, decisioni sui tassi di interesse, ecc.).

Test di accettazione sintetici deterministici per la logica di ingresso degli EA di MT5, senza accesso al mercato, al conto o agli ordini.

Il Day Trader Dashboard è un pannello visivo in stile Bloomberg per MetaTrader 5 che monitora un intervallo di prezzo intraday e segnala quando il prezzo si trova al suo interno (fade zone) o ne è uscito. Non esegue operazioni di trading: si tratta di un overlay di supporto decisionale che calcola il range massimo/minimo dalle barre recenti, traccia tali livelli direttamente sul grafico e mostra uno stato in tempo reale (scansione / all’interno del range / breakout) in un pannello a tema con ridimensionamento automatico. Supporta più istanze indipendenti sullo stesso grafico, diversi temi cromatici e elimina il 100% dei propri oggetti quando viene rimosso.

Si tratta di un pannello terminale in stile FX Dashboard sul grafico MT5, con in più alcune linee tracciate sul grafico (EMA, Bollinger, Donchian).

Uno script di audit in sola lettura per i conti su cui sono in esecuzione diversi EA (o operazioni manuali in parallelo). Raggruppa la cronologia delle operazioni chiuse in base al “magic number” e visualizza una riga per ogni “magic”: operazioni chiuse (round turn), P/L netto comprensivo di swap e commissioni da ENTRAMBI i lati dell’operazione, percentuale di successo, fattore di profitto, profitto/perdita medio, posizioni attualmente aperte e in sospeso, date di attività e simboli – ordinati in base al risultato netto, con esportazione in formato CSV per fogli di calcolo.

Daily Zone Recovery è un sistema di trading multistrategico per MetaTrader 5 che opera sulla base dei massimi e dei minimi della giornata di trading precedente. Il sistema monitora l'andamento dei prezzi in prossimità degli estremi giornalieri, utilizza tre strategie di ingresso indipendenti ed è in grado di gestire le posizioni tramite una griglia a volume fisso.

Imposta la percentuale di rischio, trascina lo stop e ottieni l'esatta dimensione del lotto espressa nella valuta del tuo conto — margine e obiettivo inclusi. Si limita al calcolo, non effettua mai operazioni di trading.

Utilità gratuita e open source per i grafici MT5 in sola lettura che valuta le attuali condizioni di tendenza e elabora piani di rischio per posizioni lunghe e corte normalizzati in base al broker. Utilizza la direzione e la pendenza della media mobile, l’ADX, l’Efficiency Ratio, l’ATR, lo spread, la valuta del conto e le specifiche del simbolo. Non apre, modifica né chiude mai operazioni di trading.

Un indicatore basato su un modello stocastico senza ridisegnamento che genera segnali di acquisto e vendita in base agli attraversamenti delle zone estreme, dotato di un filtro di segnali alternato e di avvisi alla chiusura delle barre.

Four EAs writing to the same file, all with FILE_SHARE_READ|FILE_SHARE_WRITE, FileSeek(SEEK_END), FileWrite, FileClose. Looks correct. Every FileOpen returns success. No error in the log. And the lines vanish. Reason: FILE_SHARE_WRITE lets all four open at the same time. All four call FileSeek(SEEK_END) and get THE SAME offset, because none has written yet. All four write at the same position. Whoever closes last wins. Three lines vanish silently. In my case: 12 events expected, 8 in the file. The fix is to open EXCLUSIVELY (no FILE_SHARE_WRITE) and retry while another EA holds the file. And to shout in the log when the retries run out: a log that fails silently is worse than no log at all, because you trust it. The demo script reproduces both modes. To see the loss, drag it onto four charts at the same time with safe mode off and count the lines in the CSV. On a single chart the defect does not show up - which is why it passes in testing and breaks in production.

TimeCurrent() is not a clock. It is the stamp of the LAST TICK. Two consequences break robots in production: 1. It freezes. With no tick it does not move: illiquid instrument, end of session, unstable connection - and any rule based on it stops with it. 2. It steps backwards: on a symbol switch, a reconnection or a tick from another instrument, the value can go back. The case that cost me a whole protection: I compared the date of a daily decision with TimeCurrent() to reject an expired one. The server clock stepped back to the previous day, the comparison matched, and four EAs accepted YESTERDAY's decision as valid. The gate that should have failed closed failed open - without a single error in the log. Rule: TimeLocal() for timestamps, dates, day changes, expiry - all that must always move forward; TimeCurrent() for session hours and market data. The script measures the divergence in your environment and reports both symptoms live. Run it with the market closed.

Measures, hour by hour, how far a symbol travels and how much of that the spread takes away. Built for gold, works on any symbol, compares several side by side.

Your statement tells you what you KEPT. It does not tell you what you HAD. This indicator reads your own closed trades from the account history and draws, for each one, the full range it travelled: the best unrealised profit it ever showed (MFE) and the worst unrealised loss it survived (MAE). The gap between what a trade showed and what it paid is where two common problems hide, and neither is visible in a balance curve: winners closing far below their best point (the exit leaves money behind), and losers whose worst excursion barely passed the stop (the stop sits inside the noise). The number to look at is the CAPTURE RATIO: of the profit a winner showed at its best, how much did you take home? 90% says the exits are well placed; 30% says the market kept offering and the exit kept refusing. Limit, stated up front: excursions come from the bars each trade spanned, on the chart timeframe; the path inside a bar is unknown. Predicts nothing; measures trades that already happened.

A daily process writes "today's decision" (which strategy runs, or FLAT) to a file the EAs read at the open. One day the writer did not run. The EAs read yesterday's file, compared its date with TimeCurrent() - the server clock, which had stepped back to the previous day overnight - saw a match, and traded all morning on a 24-hour-old decision. No error anywhere. Two rules, both in this class: 1) staleness is judged against TimeLocal(), which always moves forward; TimeCurrent() is the last tick's stamp - it freezes without ticks and can step back on reconnect. 2) When in doubt the answer is FLAT: missing file, bad date, wrong day, empty line - every failure path returns "do nothing", and each is logged ONCE per state change, not on every tick and not never. File format: line 1 = ISO date, line 2 = decision string. The demo writes a fresh, a stale, a malformed, an empty and a missing file, and shows that only the first is allowed to trade.

Four EAs on the same symbol, each one honest on its own: each checks "do I have a position?" with its own magic number, sees none, and enters. On a demo account this reached 22 contracts on a symbol meant to carry 1, and a watchdog had to close 16 positions in one morning. The cap belongs at the door, not after the fact. ExposureCap::Allowed(symbol, lots, cap) sums the volume of every open position on the symbol - all magic numbers, manual trades included - and refuses the order BEFORE it is sent when it would breach the cap. One log line with the three numbers (held, requested, cap) says why. Deliberately simple: gross exposure, no netting of longs against shorts, no per-EA quota. It is a check, not a lock: two EAs deciding on the same tick can both pass; in practice EAs on different charts decide on different ticks. The demo script prints held / cap / room for the current symbol and shows the refusal line. Nothing is traded.

A datetime in MQL5 is seconds since 1970 - but server time (TimeCurrent, bar times, deal times) is the broker's wall clock stored AS IF it were UTC. Export it to CSV, read it in Python or a spreadsheet with a "seconds since 1970 UTC" parser, and every timestamp shifts by the server's UTC offset. On a UTC-3 broker that is three hours: the daily bar dated 00:00 reads as 21:00 of the previous day, and "yesterday's session" silently becomes "today's, half formed". That happened to a morning report of mine before this script existed. The script prints TimeTradeServer, TimeCurrent, TimeGMT and TimeLocal, the three offsets between them, the tick lag, and this chart's last bar time in server time and in real UTC - then states the rule: export server timestamps as wall-clock text, or export the epoch together with the offset, and never let the consumer apply its own timezone.

A simple MQL5 script that calculates the correct lot size for a trade based on your account risk percentage and stop loss distance in pips, so every trade risks a consistent, controlled amount of your balance.

Sizes your next trade based on the correlated risk you already have open across other positions — not just the trade in isolation.

Checks your trade history against common prop-firm challenge rules — profit target, max daily loss, max drawdown, consistency rule, and minimum trading days — with a clear PASS/FAIL report.

Analizzatore professionale open source della forza delle candele per MetaTrader 5. Analizza in tempo reale il corpo della candela, le ombre superiori e inferiori, la pressione degli acquirenti e dei venditori, il rifiuto, l'espansione del range e la forza della candela.

Strumento di gestione delle operazioni direttamente sul grafico per MetaTrader 5, progettato esclusivamente per modificare le posizioni esistenti, sia manuali che gestite da EA. Offre comandi con un solo clic per l’impostazione del Break-Even, gli offset in punti, il blocco dei profitti, i trailing stop, gli obiettivi di Take Profit con rapporto rischio/rendimento (1R–3R) e le chiusure parziali convalidate in base al volume (25%–100%). Include un’interfaccia grafica trascinabile sul grafico e la possibilità di filtrare per simbolo e direzione. Non apre nuove operazioni.

A small educational Expert Advisor showing how a classic Donchian breakout can be applied directly to completed Renko bricks.

Cost is the one input to a trading system that is knowable exactly, and it is almost always estimated wrongly - always in the direction that flatters the strategy. This EA measures what one round trip really costs on YOUR broker: the live spread sampled from ticks, the swap for both sides including the triple-charge day, and the commission read from your own deals. Most spread figures come from the bar's "spread" field, because that is the easy one to reach. It is a per-bar summary, not the quote at any instant. Measured on XAUUSD: 20 points live across 60 readings against a bar-field median of 6. A factor of 3.3. So a filter set to "skip if spread > 15" never fires - it lets through exactly the moments it exists to block. Swap is the half most custom simulators do not charge at all. It is asymmetric, one side pays while the other collects, and one weekday counts three times. Read-only: it never opens, closes or modifies a position.

A SuperTrend that returns the same values as TradingView's ta.supertrend, shipped with the tool that proves it bar for bar against the Pine reference

1...101112131415161718192021222324...221