Codici sorgente MQL5 di Script per MetaTrader 5
Gli script eseguono azioni uniche in MetaTrader 5, utilizzando un programma MQL5 e vengono eliminati dal grafico subito dopo. Le funzioni esemplificative includono il caricamento della cronologia di trading, la generazione di rapporti e il loro invio via e-mail, il download e l'elaborazione dei dati da un file. Gli script possono essere utilizzati anche per creare un'interfaccia grafica o per eseguire rapidamente operazioni di trading di un solo tipo, per esempio per chiudere immediatamente tutte le posizioni.
È possibile scaricare e lanciare gli script disponibili in MetaTrader 5. La libreria di script è anche disponibile direttamente dalla piattaforma MetaTrader 5 e dall'ambiente di sviluppo MetaEditor.
- App di trading gratuite
- Oltre 8.000 segnali per il copy trading
- Notizie economiche per esplorare i mercati finanziari
Consenti l'uso dei cookie per accedere al sito MQL5.com.
Abilita le impostazioni necessarie nel browser, altrimenti non sarà possibile accedere.
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.
Closes all open positions and optionally deletes pending orders with one click. Filter by symbol and magic number.
Shows the broker's hidden financing markup and the carry for every symbol, as annual % of notional.
Script that reports what an EA has to cope with here: hedging or netting, trade permissions, filling modes, stop and freeze levels, volume rules, swaps and the positions already open on the symbol. Saves a report file you can attach to a Freelance order.
Reads your closed trades, converts each to an R-multiple and simulates many future runs at a chosen risk per trade. Reports the probability of hitting a drawdown floor, the probability of ending profitable, the median ending balance and the 95% range. Read-only.
MarketInfo è un semplice script informativo per MetaTrader 5. Raccoglie e registra nel log i dati chiave relativi al simbolo corrente: prezzi, spread, volatilità (ATR), tempo rimanente alla chiusura della candela, statistiche su N candele e identificazione del trend.
Before the Friday close: estimates how much your open positions could lose if the market reopens with a gap, and compares it with the room left under the daily loss limit of the next trading day. For prop firm and funded accounts. It only reads the account.
Running several EAs on one account? This script groups the closed trades by magic number and shows the score of each EA: win rate, profit factor, net profit and drawdown. Read-only, writes a CSV file.
Free script exporting clean, deterministic OHLC + tick volume + 4 indicators (MA, RSI, MACD, ATR) for M1/M15/H1 to CSV. Closed bars only, zero lookahead — ideal for analysis and ML datasets.
Una rapida analisi del mercato per individuare i trend sostenibili. Lo script analizza in un secondo tutti i simboli presenti nella "Panoramica di mercato" e individua gli strumenti con il movimento più netto e forte utilizzando la regressione lineare R² e l'indicatore ADX.
A script for accounts that run several Expert Advisors or configurations. It aggregates the net result of each configuration (magic number, or magic number and symbol) per calendar day and measures how much each one contributes to the portfolio drawdown: drawdown added by leave-one-out, share of the worst drawdown, and Euler variance share. It prints verdicts, recommendations, and a heuristic A+ to F score. It runs out of the box on a built-in demonstration portfolio and is written in pure MQL5.
Exports bars to a CSV file that pandas.read_csv() loads without encoding, separator or date-format arguments: ISO 8601 timestamps, prices at the symbol's own digits, single-byte encoding. Two modes (last N bars or a date range) and a switchable separator for Excel.
Shows what every buffer of an indicator holds - arrows, a line or a colour index - and labels the arrows on the chart with their buffer numbers. Works with compiled indicators without source code.
Calculates the lot size for a chosen risk percent and stop loss distance, and shows the result in a clean panel on the chart.
Read-only MT5 script for exact Market Watch symbols: contract and volume rules, quote age and spread, isolated BUY/SELL margin, one-tick price moves and spread-only results in account currency. MIT source; Experts journal output.
Writes the trading specification of every symbol to a CSV file: volume step, filling modes, stops level, tick value and more.
Apre un’operazione virtuale tra parentesi su ogni barra M1, la fa scorrere in avanti sulla cronologia reale dei tick e rileva, per una serie di distanze di stop, con quale frequenza la modellizzazione OHLC a 1 minuto attribuirebbe all’operazione un risultato opposto a quello previsto.
Esporta una riga CSV per ogni operazione chiusa con i dati che non compaiono nell’estratto conto: il massimo profitto non realizzato registrato dall’operazione (MFE), la massima perdita non realizzata subita (MAE), la quota effettiva di MFE mantenuta, il numero di barre coperte e la durata della posizione. Si tratta delle stesse metriche dell’indicatore Trade Excursion, ma salvate in un file anziché visualizzate su un grafico, poiché le domande che vale la pena porsi su questi dati sono quelle a cui un grafico non può rispondere: il rapporto di cattura dipende dall’ora di ingresso? Le operazioni che chiudo in anticipo sono quelle che mantengo più a lungo? Le operazioni in perdita del lunedì raggiungono un MAE diverso rispetto a quelle del venerdì? Basta una tabella pivot una volta che il file CSV è disponibile. L'output è separato da punti e virgola con una riga di intestazione, in formato MQL5\Files; si apre in qualsiasi foglio di calcolo. Limite di misurazione: le escursioni derivano dai massimi e dai minimi delle barre sul timeframe scelto; il percorso all'interno di una barra è sconosciuto. La colonna delle barre riporta la risoluzione ottenuta da ciascuna operazione, e il riepilogo conta separatamente le operazioni su singola barra invece di calcolarne la media.
Measures how far your PC clock is from the trade server's clock, from the server time stamped on live ticks, and tells you how to fix it.
Personalizza il tuo assistente AI di MetaTrader 5 scegliendo la lingua, la personalità, il menu e il comportamento tramite un semplice file di prompt.
Exports closed trades to CSV with Maximum Adverse Excursion (MAE) and Maximum Favorable Excursion (MFE) in points and money, calculated from M1 history, plus the percentage of the available move each trade captured.
Opens charts for all Market Watch symbols or a custom symbol list in one click, on any timeframe, with an optional template applied to each chart. Skips charts that are already open and limits how many are opened at once.
Resamples your closed trades 10,000 times to show whether your average trade is an edge or could still be luck: the 95% range of the average and the chance it is below zero.
Tests whether live closing deals still match the backtest of an Expert Advisor. A bootstrap-calibrated CUSUM detector raises an alarm and estimates when the drift began, a two-window check separates a short dip from a lasting decline, and an expectancy decomposition shows whether the win rate or the trade sizes changed. The script generates demonstration data on the first run and is written in pure MQL5.
Script that lists the global variables of the terminal with value, last access time and age, filtered by prefix, substring and age. It exports them to CSV, deletes the matching ones after a confirmation and a backup, and restores them from a CSV file.
Verifica se un indicatore grafico viene aggiornato, anziché affermare che ciò non avvenga. L'invariante: una volta che una barra si è chiusa ed è stata elaborata, nessun oggetto disegnato su di essa può mai cambiare: non può spostarsi, cambiare colore, modificare il proprio testo né scomparire. Lo script genera un simbolo personalizzato con dati storici reali, associa il tuo indicatore tramite un modello, registra ogni oggetto, aggiunge le barre, forza un ricalcolo completo e confronta oggetto per oggetto. Le modifiche e le sparizioni vengono conteggiate separatamente, poiché solo una modifica implica che l’affermazione sia falsa. Un’esecuzione che non ha rilevato alcuna differenza viene segnalata come INCONCLUSIVA, mai come superata. L’output è un file CSV che è possibile pubblicare accanto al numero.
Neural Loss-Pattern Auditor addestra una piccola rete neurale feed-forward, scritta da zero in MQL5 nativo, sulla cronologia delle operazioni chiuse per verificare se le caratteristiche comportamentali e relative al contesto di mercato consentano di prevedere quali operazioni abbiano una maggiore probabilità di generare perdite. Fornisce un miglioramento dell’accuratezza rispetto a una linea di base ingenua, una tabella di calibrazione delle probabilità, una classifica di importanza delle caratteristiche basata su permutazioni e un voto composito configurabile da A a F con raccomandazioni. Al primo avvio utilizza un conto demo sintetico integrato, quindi i risultati sono immediatamente visibili senza alcuna configurazione; è sufficiente impostare un parametro su InpUseDemoData=false per analizzare invece la cronologia di un conto reale. MQL5 puro: nessuna libreria esterna, nessun Python e nessun servizio di intelligenza artificiale di alcun tipo.
Valuta se un segnale di ingresso superi effettivamente i costi di transazione, prima che tu passi settimane a sviluppare un EA basato su di esso. Fornisce il risultato netto al netto dei costi, una statistica t affidabile su campioni non sovrapposti e un controllo casuale. Non emette alcun ordine.
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.
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.
Test di accettazione sintetici deterministici per la logica di ingresso degli EA di MT5, senza accesso al mercato, al conto o agli ordini.
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.
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.
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.
Reports, month by month, whether your symbol really has ticks or only bars - so you know which part of your backtest ran on generated ticks before you trust the curve. The Strategy Tester gives you one History Quality figure after the test has finished, and it never says which months were the problem. This script asks first.