Either you're standing too close to the ledge, or you're holding down on the control stick as you fall through ledge grab range (which stops you from grabbing it). It's unlikely to be the former as you have to be extremely close to the ledge for you to fail to grab it; the only way I can consistently replicate it is by repeatedly rolling to the ledge, walking very slightly forwards, and then doing a long wavedash off.
You can be successful from very close to the ledge if you do a short wavedash; almost any spacing short of approximately where your character's feet overhang the ledge presents no significant risk of accidentally airdodging offstage, and guarantees you'll grab the ledge.
If you fastfall then you will always grab the ledge regardless of your spacing, so long as you don't hold down for too long. You should pretty much always fastfall anyway, as it's significantly faster and is trivial to execute consistently once you get used to it. See this thread for details:
http://smashboards.com/threads/wavedash-ledge-grab-frame-data.404871/
Your sequence of actions should be:
• Wavedash
• Return the control stick to neutral
• Either just before or just after you leave the stage, hold down on the control stick to fastfall (the earliest possible fastfall input is the 2nd to last frame before leaving the stage; it buffers if you keep holding it)
• Fastfall for a little bit, then return the control stick to neutral so you can grab the ledge