[structure: see text]. A novel linear triferrocene derivative has been prepared and proven to be of special interest in the study of intramolecular electron transfer and as a specific optical and electrosensor for Mg(2+) cation.