Loading…

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

SettingDefaultWhat it does
SymbolSymbol (blank = current chart symbol)
DirectionPlanBuyPlanned direction
Lots0.10Planned lot size
Entry price0.0Planned entry price
Stop loss0.0Planned stop loss price
Take profit0.0Planned take profit price
Confidence3Confidence, 1 (low) to 5 (high)
Setup reasonWhy this trade - the setup
Invalidation reasonWhat proves the idea wrong

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria