General information concerning the XM file format.
Tracker should indicate their name in the XM header at offset 38.
Detecting other trackers
Some trackers disguise as FastTracker 2, but there are ways to uncover this diguise.
ModPlug Tracker (general)
ModPlug Tracker uses zero-padded strings rather than space-padded strings for sample, instrument and song names. Note that FT2 does not sanitize some fields, so it is possible that a file made with e.g. ModPlug Tracker and then re-saved in FT2 will still be detected as file made with MPT, as e.g. the song name will remain zero-padded.
ModPlug Tracker 1.0
Tracker ID is "FastTracker v 2.00" (mind the extra space). Instrument header size is either 245 (MPT 1.0 alpha) or 263 (MPT 1.0 beta).
ModPlug Tracker 1.x
ModPlug Tracker 1.09 (and maybe some older / newer version) sets both the "normal loop" and "ping-pong loop" flag for ping-pong-looped samples, while only the latter flag should be set.
Tracker ID starts with "*Converted ", instrument header size is 29.
Header size fields
The main header size is variable and can be shortened to not store the entire order list (256 bytes), but some less compatible players (e.g. WinAmp) will choke on this. Thus, the most compatible way is to always write the entire order list.
The instrument header size (first field of the instrument header) must be respected, otherwise some files will not load correctly. If the size in the file is smaller than the actual header size, pad it with zeros. However, the sample header size is completely ignored by FastTracker 2. Early versions of Sk@leTracker wrote 0 in this field, and there are files in the wild with other, completely arbitrary values (e.g. cybernostra weekend.xm). Hence, ignore this value completely.
For a list of all the file format hacks that ModPlug Tracker / OpenMPT added to the XM format over the years, see the OpenMPT Format Extensions article.