Loading…

Drawing Activity Recorder

The chart only ever shows the analysis you have right now. Every earlier idea that got erased, moved or replaced leaves no trace - there is no built-in history of a trader's own drawing activity, which is exactly the record a post-mortem or a trading journal actually wants. MQL4 has no "an object changed" event to subscribe to. The only available technique is polling ObjectsTotal() on a timer and diffing the current object set against the previous snapshot. This EA does that diff carefully rather than just logging a raw object count: each object is tracked by name across polls, so an added object, a removed object and a moved/resized object (same name, different anchor time or price) are told apart and logged as distinct events, not folded into one ambiguous "something changed" line. Polling runs on a timer, independent of tick volume, so a quiet symbol with few ticks still gets checked on schedule. An optional heartbeat row can be written every N polls even when nothing changed, so a log reviewer can confirm the recorder was actually running through a stretch with no drawing activity, rather than being unable to tell "nothing happened" from "this wasn't running." Notes and limitations Detects add/remove/move by comparing OBJPROP_TIME/OBJPROP_PRICE anchor 1 only - a resize that keeps anchor 1 fixed (dragging only the second anchor of a trend line, for example) is not currently distinguished from "unchanged" by this diff. Object colour, text or style changes are not tracked, only existence and anchor-1 position. Polling has a real (if small) blind spot: an object added and removed again between two polls leaves no trace, since only the state at each poll instant is ever captured. A shorter InpPollSeconds narrows this window but cannot close it, since MQL4 has no true change-event API for chart objects. Objects created by other EAs or indicators on the same chart are logged identically to manually-drawn ones - there is no way to tell authorship apart from the object list alone.

Expert advisor · MT4 · v1.0 · Free

About Drawing Activity Recorder

Drawing Activity Recorder is a script for MetaTrader 4. It has 4 settings, such as Poll seconds, Log template bar and Heartbeat every. MQL source code included.

Files in the download: DrawingActivityRecorder.ex4, DrawingActivityRecorder.mq4, DrawingActivityRecorder.txt.

Settings

SettingDefaultWhat it does
Poll seconds5How often to check chart objects for changes, seconds
Log template bartrueAlso log a row when the object count is unchanged but nothing moved (heartbeat)
Heartbeat every60Write one heartbeat row every N polls when nothing changed (0 = never)
File prefixDrawingLogLog filename prefix

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Trend · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria