I can probably do no better than refer you to the 1957 and the 1984 Occupiers Liability Act.
There is a reasonable synopsis here: https://thecrimepreventionwebsite.com/garden-boundaries-fences-and-defensive-plants/614/the-uk-law-concerning-fences-walls-and-gates/
Whatever measures you have have to be visible.
I cannot guarantee that you wouldn’t end up in court with these. Unlikely, but possible.
However what you could do and people do with great effect is to put a row of bricks so as to castellate the top. That would do the job without the possibility of an injury claim. Not a very good photograph and it’s not done from bricks but this kind of thing:
A row of dry stonewall stones (with mortar) would do the job.
You could use anticlimb/vandal paint but I think you are going to be at risk of a claim for it getting onto people’s clothes.
You cannot course apply to court for an injunction against persons unknown and if they were to sit on the wall, you could call the police you would need signage telling them of the risk. Not particularly practical.
Can I clarify anything else for you?
I am happy to answer any specific points arising from this.
Please take a moment to look at the top right-hand corner of the page and rate my service by clicking one of the stars at the top of the screen.
You may need to login again to use the rating service. Although it says "rate to finish" it doesn't close the thread and we can still exchange emails.
It's important that you use the rating service because that gives me credit.
It doesn't just give me a pat on the head! It's what gets me paid!!
There is also an experts incentive scheme whereby the more 5 star ratings I get I do actually get a pat on the head!
All you need to do is press Submit.
If you still need any points clarifying, I will still reply because the thread does not close.