Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Scripts

Trade History Stats - script for MetaTrader 5

Blessing Samuel Olasunkanmi
Blessing Samuel Olasunkanmi
Forex trader, MQL5 developer and founder of OlaDigital Nexus Framework, a registered Nigerian business focused on programming, trading and e-learning.
Views:
12
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
Trade History Stats reads your account history and shows how your trading really performed. It works for manual trading and for Expert Advisors, and it can filter by symbol and magic number.
 
The script is read-only. It never opens, modifies or closes any trade.
 
What it reports (per symbol and in total):
- Number of closed trades
- Win rate
- Net result (profit + swap + commission + fees)
- Profit factor
- Average win and average loss
- Longest losing streak (in the order the trades were closed)
 
How it works:
- Deals are grouped by position ID, so a position that was closed in several parts counts as one trade, with all its costs included.
- Balance, credit and bonus operations are ignored.
- Trades are sorted by close time before the losing streak is counted.
- Break-even trades are counted as losses (they made no profit).
 
Inputs:
- History period (days): 0 = all history
- Only this symbol: empty = all symbols
- Only this magic number: -1 = all, 0 = manual trades only
- Save CSV: writes MQL5\Files\TradeHistoryStats.csv (opens in Excel)
- Show summary window: shows the total in a message box
 
How to use:
1. Copy TradeHistoryStats.mq5 to MQL5\Scripts and compile it.
2. Drag the script onto any chart and set the inputs.
3. Read the summary window. The table per symbol is in the Toolbox, Experts tab.
 
Tip: To check an EA, set its magic number in the input. Compare the result with the Strategy Tester to see if live results match the backtest.
 
Screenshots to upload (take them yourself):
1. The inputs window
2. The summary message box
3. The Experts tab with the table
4. The CSV opened in Excel (optional)
 
 
=====================================================================
2) FORUM (Add new topic)
=====================================================================
 
Section: General (or "Expert Advisors and Automated Trading")
 
Title:
Chart panels in MQL5: Comment(), chart objects or CCanvas - what do you use and why?
 
Text:
Hello everyone,
 
I build indicators and EAs for gold, forex and synthetic indices, and I spend a lot of time on the on-chart panel, because that is what the user looks at every day.
 
So far I have used three approaches:
 
1. Comment() - fastest to write, but one font, one color, fixed position, and only one program per chart can use it.
2. Chart objects (OBJ_RECTANGLE_LABEL + OBJ_LABEL) - full control of colors and layout, easy to update one value, works in visual testing. The downside is managing many objects and cleaning them up.
3. CCanvas - full drawing freedom (rounded corners, small charts inside the panel), but the whole bitmap must be redrawn on every change.
 
At the moment I use chart objects with a small class: a "cursor" that moves down as rows are added, updates that only write values that changed, and the user's chart colors saved and restored on removal.
 
A few questions for experienced developers:
- Which approach do you use for panels that update on every tick?
- Have you measured a real performance difference between many OBJ_LABEL objects and one CCanvas bitmap?
- How do you handle high-DPI screens (150% / 200%)? I scale all pixel sizes with TERMINAL_SCREEN_DPI / 96. Is there a better way?
 
I would like to hear what works for you.
 
Thank you.
 

Session Sweep Tracker: Does the Asian High and Low Hold, Get Swept or Break at the London Open? Session Sweep Tracker: Does the Asian High and Low Hold, Get Swept or Break at the London Open?

Measures what happens to the Asian high and low when the next session opens. Every day the Asian range is frozen, and during a watch window that follows, each side is classified as swept (a wick beyond the level that closes back inside), a failed break (closed beyond, then back inside) or a held break. The chart shows the Asian range with its midpoint, a line shows where the close is inside the range, and a panel gives the shares for each side, which side moves first, how long it takes, and one line that can be pasted into a comment to compare symbols. It gives statistics, not signals.

History Depth Check - how far back your EA can read on each timeframe History Depth Check - how far back your EA can read on each timeframe

Shows, for each timeframe and symbol, how many bars an EA, indicator or script can read on a live chart and from what date, and flags the timeframes where "Max bars in chart" cuts off older history that the terminal already has.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.