The problem you describe can be handled as an optimization problem: evolve a program such that it maximizes some performance measure. The technique you may want to look into is called "Genetic Programming". For a financial application see for example Single versus Multiple Tree Genetic Programming for Dynamic Decision Making.
OK, in for a penny, in for a pound :-)
First, let us assume that you have symmetrical critical levels higher and lower (call them “target” and “stop” if you will). Only in this case is the hit rate relevant.
Even, then the hit rate is a function of time. If you take a 5d/1w view, then being 51% right is very different to being to being 51% right on a 21d/...