Trade Plan File Writer
A trade journal filled in after the fact is usually filled in by hindsight rather than memory: the stop "was obviously" too tight, the setup reason grows extra detail that was never actually seen at entry time, and losing trades quietly get a better story than they had going in. The only way to capture what was really thought before the outcome is known is to write it down before the outcome is known. This script takes the plan as input parameters, checks the entry/stop/target triangle actually makes sense for the chosen direction (a buy plan needs its stop below entry and its target above it, and vice versa for a sell), and appends one row to a CSV journal - creating the file with a header on first run and appending to it on every run after. The row stores the planned stop distance and target distance in pips and the reward:risk ratio those imply, plus two short free-text fields: the setup reason, and what would prove the idea wrong. A plan whose price triangle is nonsensical is rejected outright rather than logged, since a broken row is worse than no row. Notes and limitations This script only writes a file - it never sends an order, modifies a chart, or checks the plan against the live market price. It is a journalling aid, not a trade filter or a confirmation dialog. The journal is a single append-only CSV shared across every symbol and run; delete or rename TradePlan_Journal.csv manually if a fresh journal is wanted (for a new strategy test, for instance). Lot size is recorded exactly as typed and is not checked against the symbol's minimum/maximum/step, since no order is placed - treat it as a planning note, not a validated trade size.
Script · MT5 · v1.0 · Free
About Trade Plan File Writer
Trade Plan File Writer is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 9 settings, such as Symbol, Direction and Lots. MQL source code included.
Files in the download: TradePlanFileWriter.ex5, TradePlanFileWriter.mq5, TradePlanFileWriter.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol (blank = current chart symbol) | |
| Direction | PlanBuy | Planned direction |
| Lots | 0.10 | Planned lot size |
| Entry price | 0.0 | Planned entry price |
| Stop loss | 0.0 | Planned stop loss price |
| Take profit | 0.0 | Planned take profit price |
| Confidence | 3 | Confidence, 1 (low) to 5 (high) |
| Setup reason | Why this trade - the setup | |
| Invalidation reason | What proves the idea wrong |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Script · MQL5 Source Code