I havent tested this and macros are not my best friend but try to sync them alittle with castsequence were , , is a button press that is not keyed to any spell.
You could try something like this

button 2 (dots and fire ball)
warlock
/castsequence reset=combat/target dot1 , dot2, dot3 , dot4

mage
/castsequence reset=combat/target Frostbolt, , ,Frostbolt

this should

press 1 : apply dot 1 and start the fireball cast
press 2 : apply dot 2
press 3 : apply dot 3
press 4 : apply dot 4 and start the fireball cast again

how well it syncs will depend on how fast you mash the 2 button.

I'm sure others will have more elegant solutions