Can your daughter tell you how she is feeling? Is it the swapping back & forward between houses that causes the problem? Or something else?
Can she tell you what she would like to change? If she can tell you quietly when she isn’t under any pressure, perhaps you could explain what she said to your ex.
Have you tried talking to her teacher. Does she share her problems at school?
Why does your ex get angry? Is it because he thinks you want to reduce his 50% or is it financial? Surely he doesn’t want to cause her distress.
Can you swap holiday and term days to suit your daughter better? Or can he come and do bedtime routine at your house as a compromise?