If you have the ability to learn to code then that is always the best solution even if it takes a few months or a year.
If you have no choice but to hire someone, then just hire a code monkey who has no apparent interest in trading.
Giving the secret sauce to someone who approached you? Hell no. Your incentives are not aligned with this person and you have a high chance of getting screwed over. You already sense this and that is why you started this thread. Contracts won't really help you that much, if you need to try to enforce one then you already lost. Even if it works out, it sounds like the value being exchanged is not equivalent. A few weeks of coding work is worth thousands, but your system may be worth millions.
The only exception to this would be if you know the person really well and you trust yourself to be a good judge of character. If you're willing to go into business together 50/50 with them then your incentives will be much better aligned. This has a much better chance of working out over the medium term (although I will note it can still fail and also has a chance of ruining your friendship)
Thank you for your good comment.
I don't really need to make changes or new implementations at this point as what I have is mostly working. Although it's a bit inefficient in terms of the implementation (relates mostly to speed and updating of data). I've always thought that at some point I would want to make changes to arrive at the optimal solution, but at the back of my mind I've always wondered how I could do that without giving away any secrets as I imagine a full re-write would require some explanation. This is particularly so as in a way I built the last part of the system on my own without any programmers involved.
This opportunity came up mostly after a discussion on machine learning in some other forum and where I openly said that it's possible the best solution for me as a no-programmer is to collaborate with a programmer who have interest in learning the financial markets. I wasn't really actively shopping for it. Just thinking out loud. And then we started talking a bit in private.
As far as I can tell this guy seems like an honest guy with good intentions and passion for such a project, but then again, people have disappointed me in the past.