You're looking at this wrong way.
Buy a gumball machine.
Put on fence.
Fill machine with enough feed for the day.
Charge other people to feed your ducks
No, its a gumball machine. A dispenser. So it can dispense anything such as bird seeds for the ducks. Put in a coin and out comes bird feed AND a gumball. The gumball is for you.
Obvious answer is to give the kids ducklings for every visit. Pressuring kids parents to stop their kids coming over without permission. Unless they want to own duck pets.
Get some thick over sized glasses that are that transparent brown colour on the rims, grow a thin but dirty moustache, only wear faded pastel tops and short stained shorts that are 1 or 2 sizes to small, ALWAYS show your belly, make sure to be overly friendly but never blink when making eye contact, sooner or later they'll all leave your house alone.
That makes it sounds like it's legally mandated for there to be a sexual predator there. When the house gets sold, do the new owners now have to go and molest someone??
My grandmom used to hang dead birds in her garden to warn others from coming to eat her berries. Maybe this works with kids too, you just need to get a dead one from somewhere first.
Make sure the place they stand has no vegetation, and is always soaked, so their shoes inevitably get muddy. When they track the mud inside their houses, their parents will flip out and tell them not to go to your property again.
Or just put a motion sensor sprinkler to spray them when they get close.
My joke answer is to directly tell them that they are not allowed to come on your lawn, to not let their kids do the same, and that it's your property, not a zoo.
This way you'll guarantee that your house is egged often enough that some of the eggs may not break, and some subset of those could be adopted by the ducks and hatched into baby birds that the kids also won't be able to come look at.
Can I non-jokingly ask why that's such a big deal? If it's all up in your grill I get it, or some stupid liability thing. Otherwise, there's little enough joy in the world, what's the harm?
My biggest thing is people getting hurt on my property. Also, I have boundaries and don't want to be surprised by people just hanging out, especially because I have a super anxious dog.
Seriously, embrace the situation. People are interested in hanging out with/near you. If you are the person who stops all the kids seeing the ducks you could end up being seen as the scrooge of the town. Then nobody will like you. If you want nobody to interact with then maybe you should live away from people.
It might seem like those kids have nothing to offer to you but their parents might. My wife makes jam for our friendly neighbors...
To address your question though, you could make it official, one day a week the kids come to see the ducks but maybe you need it quiet the rest of the time to work or whatever. Tell them when to come and they can get it out of their system.
Had a friend with problem neighbors kids cutting through his yard to get to the store. He was friendly with the parents and didn't want to stir shit. The neighbors were super all-natural, hippie, no chemical types, so he told them he switched to a new fertilizer packed with micro-plastics and forever chemicals made by Monsanto that he had to sneak in from Mexico because it wasn't allowed in the US. That fertilizer sure worked because the trail the kids were carving filled right in that summer.
Cover your yard in red paint, chunks of meat and feathers? You wanted humour, but was that a bit too grim? Sorry…
Put up a gate and a sign saying “$1 Entrance Fee”. If you want to get even sillier, draw a horizontal line about 7ft off the ground on the sign plus the text “Must be at least this tall to enter”.
Walls, barbed wire, around the entire perimeter. Hire a pmc to patrol the grounds. If the kids are caught, extraordinary rendition them to a blacksite in an allied former Soviet state. If they escape before capture, send out operatives disguised as soccer/little league/gymnastics coaches until you locate and black bag them. Same fate as the initially captured. They’ll either get the memo or run out of kids
"I'm assisting as part of an experimental penal system. I just want you to be aware that all of these ducks were once human child rapists who were transformed in exchange for lighter sentences."