Smarter Custom Formulas

Tom G., a client (name used with permission), came to me with an observation.

“I’m seeing a pattern with my strategy. When filter A, B, and C values increase, those trades tend to perform better. Is there a way to scan for that?”

The smart way to do this is to create a custom formula for A < B < C.

When the values increase, the custom formula is 1, and 0 otherwise.

And that’s how most traders handle it – but there’s a far more powerful way to do this.

When you reduce a situation to a yes/no boolean, you essentially remove valuable details in the process.

Consider two very different examples:

A = 1, B = 2, C = 3

A = 1, B = 2, C = 1000

In both cases, the value for the “increasing” custom formula would be 1 since A < B < C.

But, of course, these are VERY different situations – it doesn’t make sense to reduce this to a simple boolean.

To simplify the example, let’s consider a more common scenario familiar to traders.

How does your strategy perform when the price is above the 50-day moving average versus below?

You could create a custom formula for Price > 50DayMA that results in values of 1 or 0.

A better way is to use a continuous variable such as the distance from the 50-day moving average:

Distance from 50DayMA = (Price – 50DayMA) / 50DayMA

This allows you to use a single variable without removing important details unnecessarily.

Continuous variables are far easier to optimize than booleans.