#MQL5
7/ The notes are the feature.

A converter that guesses silently is worse than no converter. One that says "I changed this line, verify it" is one you can use on a Friday.

Free, in the browser. Link in bio.

Comment "CONVERT" and I'll DM you the free browser MQL4 to MQL5 converter link.
November 14, 2026 at 3:31 PM
MQL5 timer tip: EventSetTimer returns a bool, so check it in OnInit and fail init if it is false. Call EventKillTimer in OnDeinit. A new timer event is not queued while one is already waiting, so a slow OnTimer skips beats. Measure elapsed time with GetTickCount64, not a counter.
November 12, 2026 at 6:21 AM
A daily loss guard for an MQL5 EA that counts closed deals and open equity
Most EAs that blow an account do it in one bad day, not over a month. A daily loss guard is the simplest protection against that, and it is also what most prop firm rules require. The tricky part is measuring the day's loss correctly. Two common mistakes: 1. Comparing current balance with yesterday's balance. That ignores open trades, so the EA can sit on a large floating loss and keep opening new positions. 2. Using the PC clock for the start of the day. The trading day follows the broker server time, which is often two or three hours away from yours. The approach below records the equity at the start of each server day and blocks new entries once equity falls a set percentage below it. It can also close everything when the limit is hit. ## Inputs and state input double InpMaxDailyLossPct = 3.0; // max loss per day, percent of start equity input bool InpCloseOnLimit = true; // close open positions when hit input long InpMagic = 12345; // this EA's magic number double g_dayStartEquity = 0.0; datetime g_dayStart = 0; bool g_blockedToday = false; ## Detecting the new server day datetime ServerDayStart() { MqlDateTime t; TimeToStruct(TimeTradeServer(), t); t.hour = 0; t.min = 0; t.sec = 0; return StructToTime(t); } void UpdateDay() { datetime d = ServerDayStart(); if(d != g_dayStart) { g_dayStart = d; g_dayStartEquity = AccountInfoDouble(ACCOUNT_EQUITY); g_blockedToday = false; PrintFormat("New server day %s, start equity %.2f", TimeToString(d, TIME_DATE), g_dayStartEquity); } } Taking a snapshot of equity rather than balance means a trade carried overnight is counted from where it stood at midnight, which is what most prop firm rules do. ## The check bool DailyLossHit() { if(g_blockedToday) return true; double eq = AccountInfoDouble(ACCOUNT_EQUITY); double limit = g_dayStartEquity * (1.0 - InpMaxDailyLossPct / 100.0); if(eq <= limit) { g_blockedToday = true; PrintFormat("Daily loss limit hit: equity %.2f, limit %.2f", eq, limit); if(InpCloseOnLimit) CloseAllMine(); return true; } return false; } `CloseAllMine` is whatever routine your EA already uses to close its own positions, filtered by magic number and symbol. ## Using it in OnTick void OnTick() { UpdateDay(); if(DailyLossHit()) return; // no new entries today // normal signal and entry logic below } Run the check before the signal logic so a blocked day never reaches OrderSend. ## Surviving a restart If the terminal restarts in the middle of the day, `g_dayStartEquity` resets to the current equity and the EA forgets the morning's losses. Save the two values in terminal global variables so a restart picks them up: void SaveDay() { GlobalVariableSet("DLG_start_" + (string)InpMagic, (double)g_dayStart); GlobalVariableSet("DLG_eq_" + (string)InpMagic, g_dayStartEquity); } void LoadDay() { string k1 = "DLG_start_" + (string)InpMagic; string k2 = "DLG_eq_" + (string)InpMagic; if(GlobalVariableCheck(k1) && (datetime)GlobalVariableGet(k1) == ServerDayStart()) { g_dayStart = (datetime)GlobalVariableGet(k1); g_dayStartEquity = GlobalVariableGet(k2); } } Call `LoadDay()` in OnInit and `SaveDay()` whenever a new day starts. ## Things to test 1. Run the Strategy Tester over a period that includes a sharp drop and confirm the log shows the limit line and no entries after it. 2. Test with a position held over midnight and check the start equity includes its floating result. 3. Restart the terminal halfway through a losing day and check the EA still remembers the start equity. A guard like this will not make a strategy profitable, but it caps how much one broken day can cost.
dev.to
November 11, 2026 at 6:39 AM
7/ Export gives you readable .mq4 or .mq5 that compiles in MetaEditor with 0 errors and 0 warnings.

Free plan: 3 projects, H1 to D1 backtests over a year, full export and the MQL4↔MQL5 browser converter. No card.
November 8, 2026 at 3:31 PM
Writing an MQL5 trade journal to CSV with FileOpen so every EA fill is on record
The Experts log scrolls away, and the terminal history does not record why the EA took a trade. A small CSV journal fixes both. Every time a deal is added, the EA writes one line with the time, symbol, direction, volume, price, profit, and a reason string. You can open the file in a spreadsheet, compare it with the backtest, and answer questions like "why did it buy here" a week later. # Where the file goes 1. FileOpen without FILE_COMMON writes to MQL5/Files inside the terminal data folder. In the Strategy Tester that becomes the agent's own sandbox folder, which is deleted or hard to find. 2. With FILE_COMMON the file lands in the shared Terminal/Common/Files folder. Every terminal on the machine and the tester agents can reach it, so it is the easiest place for a journal. 3. MQL5 cannot write outside these sandboxes. Paths like C:\Logs are refused by design. # The journal code input string JournalName = "ea_journal.csv"; string g_lastReason = ""; bool JournalWrite(const string &fields[]) { int h = FileOpen(JournalName, FILE_READ | FILE_WRITE | FILE_CSV | FILE_COMMON | FILE_SHARE_READ, ','); if(h == INVALID_HANDLE) { Print("Journal open failed, error ", GetLastError()); return false; } bool isNew = (FileSize(h) == 0); FileSeek(h, 0, SEEK_END); if(isNew) FileWrite(h, "time", "symbol", "type", "volume", "price", "profit", "magic", "reason"); FileWrite(h, fields[0], fields[1], fields[2], fields[3], fields[4], fields[5], fields[6], fields[7]); FileClose(h); return true; } void OnTradeTransaction(const MqlTradeTransaction &trans, const MqlTradeRequest &request, const MqlTradeResult &result) { if(trans.type != TRADE_TRANSACTION_DEAL_ADD) return; if(!HistoryDealSelect(trans.deal)) return; string fields[8]; fields[0] = TimeToString((datetime)HistoryDealGetInteger(trans.deal, DEAL_TIME), TIME_DATE | TIME_SECONDS); fields[1] = HistoryDealGetString(trans.deal, DEAL_SYMBOL); fields[2] = (HistoryDealGetInteger(trans.deal, DEAL_TYPE) == DEAL_TYPE_BUY) ? "buy" : "sell"; fields[3] = DoubleToString(HistoryDealGetDouble(trans.deal, DEAL_VOLUME), 2); fields[4] = DoubleToString(HistoryDealGetDouble(trans.deal, DEAL_PRICE), (int)SymbolInfoInteger(fields[1], SYMBOL_DIGITS)); fields[5] = DoubleToString(HistoryDealGetDouble(trans.deal, DEAL_PROFIT), 2); fields[6] = IntegerToString(HistoryDealGetInteger(trans.deal, DEAL_MAGIC)); fields[7] = g_lastReason; JournalWrite(fields); } Before calling OrderSend, set g_lastReason to something short and specific, such as "breakout above 20 bar high" or "time exit after 12 bars". That string is the part the terminal history will never give you. # Practical points 1. Open, append, and close on each write. Holding the handle open for days risks losing buffered lines if the terminal crashes, and it blocks other programs from reading the file. 2. FILE_SHARE_READ lets you open the CSV in a spreadsheet while the EA is still running. Close the spreadsheet before the EA writes, or use a copy, because some editors lock the file. 3. Use a comma delimiter and avoid commas inside the reason text, or wrap the reason in quotes yourself. 4. Put the symbol and magic number in the file name if several EAs or charts share the Common folder, so two instances never append to the same file at once. 5. In the tester, write a different file name per run so optimization passes do not interleave lines. 6. Check FileOpen for INVALID_HANDLE and print the error. Error 5004 usually means a wrong path or a file locked by another program. A journal that records the reason next to each fill turns "the EA did something odd" into a line you can read, sort, and compare with the backtest.
dev.to
November 8, 2026 at 6:37 AM
MQL5 tip: ChartRedraw every tick burns CPU for no gain. Redraw on a timer, or only after you create, move, or delete chart objects. Most ticks change nothing on the chart, so skip the call until something visual actually changed.
November 7, 2026 at 6:15 AM
MQL5 tip: before OrderSend check TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) and AccountInfoInteger(ACCOUNT_TRADE_EXPERT). AutoTrading can be off, or the account can block EAs. Both return false with no order error. Skip the tick and log which switch failed.
November 6, 2026 at 6:21 AM
MQL5 tip: right after a restart SYMBOL_TRADE_TICK_VALUE can still read 0, and a risk based lot formula then divides by zero. Check tick value and stop distance are above zero before dividing, then MathIsValidNumber(lots) before OrderSend. If not, skip the tick.
November 5, 2026 at 6:21 AM
Confirming an MQL5 fill with OnTradeTransaction instead of guessing from OrderSend
OrderSend returning true, or CTrade returning a done retcode, means the trade server accepted the request. It does not always mean the position you wanted is open at the volume you wanted. Partial fills, closings that leave a remainder, and netting account quirks all show up after the request. The reliable place to learn what actually happened is OnTradeTransaction. # What to listen for OnTradeTransaction receives three structures. The one that matters for fills is the transaction of type TRADE_TRANSACTION_DEAL_ADD. That fires when a deal is added to history. From there you can read the deal ticket, then the deal properties: symbol, volume, price, deal type, position identifier, magic and entry type. #include <Trade/Trade.mqh> CTrade trade; ulong g_waitOrder = 0; void OnTick() { if(g_waitOrder != 0) return; // still waiting for the deal that belongs to the last request if(!ReadyToEnter()) return; if(!trade.Buy(0.10, _Symbol, 0.0, 0.0, 0.0, "ctb")) { Print("Buy request failed: ", trade.ResultRetcode(), " ", trade.ResultRetcodeDescription()); return; } g_waitOrder = trade.ResultOrder(); Print("Buy request accepted, order ", g_waitOrder); } void OnTradeTransaction(const MqlTradeTransaction& trans, const MqlTradeRequest& request, const MqlTradeResult& result) { if(trans.type != TRADE_TRANSACTION_DEAL_ADD) return; ulong deal = trans.deal; if(deal == 0 || !HistoryDealSelect(deal)) return; long magic = HistoryDealGetInteger(deal, DEAL_MAGIC); if(magic != trade.RequestMagic()) return; string sym = HistoryDealGetString(deal, DEAL_SYMBOL); double vol = HistoryDealGetDouble(deal, DEAL_VOLUME); double px = HistoryDealGetDouble(deal, DEAL_PRICE); long entry = HistoryDealGetInteger(deal, DEAL_ENTRY); ulong order = (ulong)HistoryDealGetInteger(deal, DEAL_ORDER); Print("Deal ", deal, " ", sym, " vol=", vol, " px=", px, " entry=", entry); if(g_waitOrder != 0 && order == g_waitOrder) g_waitOrder = 0; } # Why this is safer than polling 1. ResultRetcode DONE on a market order usually means a fill, but on some brokers and account modes you still want the deal before you size the next order or move a stop. 2. Partial fills arrive as more than one deal for one order. Summing DEAL_VOLUME for that order tells you how much is done. 3. On a netting account a "Buy" can reduce or flip an existing opposite position. The deal entry type tells you whether volume was added, closed or reversed. 4. Matching by magic and symbol keeps other EAs on the same account from clearing your wait state. # Practical tips 1. Store the order ticket from ResultOrder() when the request is accepted, then clear your wait state when a deal for that order arrives. 2. Use HistorySelectByPosition when you later need every deal that belongs to one position identifier. 3. Do not call heavy logic inside OnTradeTransaction. Set flags and let OnTick or OnTimer do the work. 4. In the Strategy Tester, transactions still fire in real ticks mode. In open prices mode some deal details are thinner, so prefer real ticks when you are testing fill handling. Treat OrderSend as the request and OnTradeTransaction as the receipt. The receipt is what your risk logic should trust.
dev.to
November 6, 2026 at 6:36 AM
Sugestões são bem vindas
www.instagram.com/reel/De-MQL5...
Instagram
Create an account or log in to Instagram - Share what you're into with the people who get you.
www.instagram.com
October 31, 2026 at 1:26 PM
Metatrader 4 Indicators | Gideon's_ATR | MQL5 Code

Discover expert developed MetaTrader tools that can complement professional solutions. Indicator Gideon's_ATR. Input Parameters: Grid trading done right...

#Metatrader #Indicators #Gideon's_ATR

Trade safe with RobotFX.

READ MORE
October 25, 2026 at 3:40 PM
Metatrader 4 Indicators | Detrended Price Oscillator | Source Code Included

Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies. The Detrended Price Oscillator is calculated by the follo...

#Metatrader #Indicators #Detrended

Trade safe with RobotFX.

READ MORE
October 17, 2026 at 8:40 AM
Metatrader 4 Indicators | Channel ZigZag | MQL5 Release

Explore the latest free tools from the MQL5 community. Here's a new indicator, expert advisor, or script for MetaTrader. Author: Tinytjan aka TheXpert A...

#Metatrader #Indicators #Channel

Trade safe with RobotFX.

READ MORE
October 16, 2026 at 8:40 PM
Metatrader 4 Indicators | Xaos Explore Perky_Mod | MQL5 Code

New free code from MQL5: indicators, EAs, and scripts for traders. An Advanced XaosExplorer indicator. Parameters: Unique stair-step trend tradi...

#Metatrader #Indicators #Xaos

Smart tools for smart traders.

READ MORE
October 16, 2026 at 8:40 AM
Metatrader 4 Indicators | ParMA BB | Free Download

Explore the latest free tools from the MQL5 community. Here's a new indicator, expert advisor, or script for MetaTrader. МА on the basis of a paraboli...

#Metatrader #Indicators #ParMA

Lower your trading risks with us.

READ MORE
October 16, 2026 at 2:40 PM
Metatrader 4 Indicators | AMA Bands | MQL5 Code

Explore the latest free tools from the MQL5 community. Here's a new indicator, expert advisor, or script for MetaTrader. The idea is called up by the article: Б. Шл...

#Metatrader #Indicators #AMA

Trade safe with RobotFX.

READ MORE
October 15, 2026 at 8:40 PM
Metatrader 4 Indicators | CCI_onMA_MAs | MetaTrader Tool

Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies. An improved version of the CCI_onMA indicator. Parameters: CCI_P...

#Metatrader #Indicators #CCI_onMA_MAs

Lower your trading risks with us.

READ MORE
October 16, 2026 at 2:40 AM
Metatrader 4 Indicators | cam_H4_Historical_V4 | MQL5 Code

Explore the latest free tools from the MQL5 community. Here's a new indicator, expert advisor, or script for MetaTrader. A modifie...

#Metatrader #Indicators #cam_H4_Historical_V4

Smart tools for smart traders.

READ MORE
October 15, 2026 at 2:40 PM
Metatrader 4 Experts | Trix EA | Source Code Included

Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies. Description: The Trix EA is based on the Trix indicator created by raff1410, i...

#Metatrader #Experts #Trix

Lower your trading risks with us.

READ MORE
October 15, 2026 at 2:40 AM
Pine to MT5 tip: request.security in Pine can silently use future bars if lookahead is on. In MQL5 you must wait for the higher timeframe bar to close before reading it. Port the bar close rule first or live results will diverge from the Pine chart. #PineScript #MQL5 #algotrading
October 14, 2026 at 6:17 AM
Metatrader 4 Scripts | Summary Report In Points | MetaTrader Tool

New free code from MQL5: indicators, EAs, and scripts for traders. Exposed script calculates profit and all secondary data in points. Sc...

#Metatrader #Scripts #Summary

Lower your trading risks with us.

READ MORE
October 14, 2026 at 8:40 PM
Metatrader 4 Indicators | DoubleCCI_Woodies | Source Code Included

Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies. This is the original indicator of which I am the ori...

#Metatrader #Indicators #DoubleCCI_Woodies

Smart tools for smart traders.

READ MORE
October 14, 2026 at 2:40 PM
Metatrader 4 Indicators | SSL_channel_chart_alert | MQL5 Code

Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies. Indicator SSL_channel_chart_alert. Parameters: Lb =10; al...

#Metatrader #Indicators #SSL_channel_chart_alert

Trade safe with RobotFX.

READ MORE
October 14, 2026 at 2:40 AM
Metatrader 4 Indicators | MACD with crossing | Source Code Included

Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies. Indicator MACD with crossing. Parameters: FastEMA=12; SlowEMA=26; Sign...

#Metatrader #Indicators #MACD

Trade safe with RobotFX.

READ MORE
October 14, 2026 at 8:40 AM
Partial close tip for MT5: when you scale out of a winner, update the stop on the leftover lots in the same trade request. Closing volume without moving SL leaves an orphan stop, or one sized for the old full position. Keep magic, symbol, and ticket aligned. #MQL5 #algotrading
October 13, 2026 at 6:18 AM