No, this is the right way to do it.
Make sure your entity between the two entities me and ball is not passable. (Code: reset(me, PASSABLE);)
I don't know if it's important but you should use | instead of + as seperator for the flags of c_trace in Lite-C (filename.c). + was the seperator of C-Script (filename.wdl) in the past.
If your ball entity is not passable then it is also be set to the you pointer after c_trace!
Your code should look like this for Lite-C:
while(1)
{
c_trace(my.x, ball.x, IGNORE_ME | IGNORE_PASSABLE | IGNORE_PASSENTS);
if ((you != NULL) && (you != ball))
{
alert = 1;
}
wait(1);
}