Will he track up if you put him in a roundyard and free lunge him? If not, then I would be getting him to a vet when you get a chance to, to do some flexion tests and possibly nerve blocks on him to see if there is any lameness.
How old is he, and how long did he race? Arthritis would not surprise me, probably in the hocks.
Medical aside, as the post above said, I would be look at back issues and possible saddle fit issues. If he has something pinching, he's not going to track up and be very unwilling to use his back properly under saddle. A sacroiliac issue could well be the stem of the issue.
If he is physically 100%, you need to look at how you are riding him. A horse won't track up under saddle if it's not being ridden forward. And the typical ottb has quite a 'sewing machine' trot so will not willingly reach forward and under its centre of gravity with the hind legs. You need to encourage the hind legs, by riding forward, and starting some work on leg yield, spiralling on circles, transitions etc.
Maybe have a more experienced rider get on him and see if they can get him tracking up under saddle.