Sometimes Codea gets a little choppy, probably because of some background processes, try resetting the ipad.
Instead of hard coding the value for the right border, I prefer to use WIDTH (wich returns the screen width) so whenever the view might change size, the border changes acordingly.
Also instead of hard coding the velocity after a bounce, you can reverse it's velocity so that it bounces off with as much speed as it hit. You can do this by multiplying the speed with -1.
This would look something like this:
if ball.x>WIDTH then
DX= DX * -1 -- reverse x velocity
ball.x = WIDTH -- set ball position to prevent passing the conditional check next frame
elseif bal.x<10 then -- elseif to check one OR the other border
DX= DX * -1
ball.x = 10
By using an elseif for the left and right borders you ocasionally save one conditional check. You can do this because when it collides with the right border you know it can't collide with the left border as well, so you only have to check one OR the other border.
By reversing the velocity you get a more realistic bounce, however this does require you to set the ball position to prevent it from becomming stuck. Because if it still collides with the border the next frame it would keep reversing it's direction infinitely.
Keep it up and let me know if I wasn't clear on something.