You should have come across anchoring a finger on the pick guard. That using slight movement of you wrist. This is common for finger picking acoustic but also works with electric.. I think more common with electric is using your palm heal anchoring on bridge.. This is also convenient for muting. Either method you need to find the same anchor point every time..
Practice on open string so you are only focused on your picking hand.. It's just going to be practice, practice, practice. Gradually add a fret, then two.. change to another string and go through the same scenario. When you get comfortable go to the scale finder and find a scale to practice..
Hope this helps you out..
Good luck and happy picking