Mage fire macro

Hello, I need a macro as a fire mage. I want a simple macro that casts the spell ‘Fireball’ only when I’m not moving, and only the spell ‘Burn’ when I am moving. I’ve tried several times but every time I end up casting fireballs and every other time casting a ‘Burn’ spell. Thanks in advance.