Last Closed Trade
This EA monitors the account's deal history and displays information about the last closed deal on the chart via Comment(). It retrieves the last deal's profit, symbol, and type, then outputs them as an on-chart overlay. It does not open, close, or manage any trades.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
Not backtested yet — this EA could not be converted automatically.
Strategy analysis
This EA is not a trading strategy but a purely informational monitoring tool. It has no entry or exit conditions since it does not execute any trading operations whatsoever. Position sizing and money management are entirely inapplicable to this EA. Its core logic calls CheckLastClosed() on every tick, which selects deal history from the day's start time to the current time, retrieves the last deal's ticket number, and reads that deal's profit, symbol, and direction. A critical logic bug exists: when the deal type is BUY, it is labeled 'Sell Trade', and when the deal type is SELL, it is labeled 'Buy Trade' — the displayed direction is reversed from the actual deal type. Additionally, the code uses HistoryOrderGetString to retrieve the symbol, but it should use HistoryDealGetString since Ticket is a deal ticket, not an order ticket. The EA redundantly re-executes history queries and Comment output on every tick without any new-deal detection or deduplication, making it inefficient.
Strengths
- Code is very concise and easy to read and understand
- As an informational display tool, it involves zero trading risk
- Uses Comment() to output information directly on the chart for convenient real-time viewing
Weaknesses
- Buy/sell direction labels are completely reversed — BUY displays as 'Sell Trade' and SELL displays as 'Buy Trade', which is a critical logic bug
- Uses HistoryOrderGetString to get the symbol instead of HistoryDealGetString; calling an order function on a deal ticket may return empty or incorrect data
- Repeats history queries and Comment output on every tick without checking for new deals, making it inefficient and potentially causing chart flickering
Possible improvements
- Fix the reversed buy/sell direction labels — BUY should display 'Buy Trade' and SELL should display 'Sell Trade'
- Replace HistoryOrderGetString with HistoryDealGetString to correctly retrieve the deal symbol
- Add a new-deal detection mechanism so the output only updates when the last deal changes, avoiding redundant per-tick history queries
Risk assessment
Overall risk: Safe
- The EA does not execute any trading operations, so it has no inherent trading risk
- However, since the buy/sell direction display is reversed, users who rely on this information for manual trading decisions may make directional errors
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
DayStart | 00:00 | Start time for historical trade scan within current day |
Similar Utility EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.