Yeah, press it as late as you can but also before you get hit, otherwise you would need to press it on the EXACT same frame you hit the wall which is a 1 frame window. Unless of course you got hit a good distance away from the wall and the attack sends you towards it normally then there'd be more time inbetween, but that isn't really an 'edgetech' in its usual meaning at that point and just teching off the wall that you got sent into.
Relying on just ASDI to edgetech will fail with higher knockbacks. After you get the feel for timing L/R and just holding towards the stage using ASDI to tech, you should probably learn to SDI by setting your damage to 999% or something when doing that.
Also, relying on ASDI to tech becomes more and more difficult to time the tech as the hitlag on the attack increases, since you can't press it during hitlag and the ASDI tech occurs after the full amount of the hitlag has passed. With SDI you can hit the wall and tech at anytime during hitlag. A powerful smash attack might only give you a 10 frame window to press the button before it with ASDI, and is even worse for electric attacks which have 1.5x the normal hitlag. Falcon's knee for example would only give you a 7 frame window using ASDI, and Samus' charged shot just 2 frames.
A good way to do it is press L/R just before you get hit like normal, and then with the control stick at neutral just as you'd go into hitlag, smash a fast 1/8 to 1/4 circle on the control stick starting from towards (if doing 1/8 circle) or down&towards (for 1/4 circle) and then ending at up&towards and holding (also gives good DI in case you miss the tech).
This is generally better than just smashing into the stage with a straght line on the control stick since it's spread out over a longer length of time and will give you a SDI if it overlaps with the hitlag much easier. Also you'll get good DI for just about any attack you'd be hit with at the edge in case you don't tech correctly.