## Trading system design and the problems of the OR logical operator

Trading system logic can be as simple or as complicated as you want it to be. You can either build systems that trade on a simple premise like the formation of higher highs or lower lows or complicated strategies that trade based on multi-symbol machine learning based models that constantly retrain. Either way you will have to make choices regarding how the logic elements within your model will be structured and this includes the choice of logical operators that you will use. Today I want to talk about the “or” logical operator and the consequences that its use has on trading system creation. I will talk about how its use affects the universe of potential systems and the immediate problems that arise when OR operators are coupled with automated strategy searching processes.

Regularly trading strategies make use of only the AND logical operator when multiple conditions for entries can be set. For example you may want price to cross over its 20 period moving average AND for price to cross the 80 level of the RSI 20 period indicator. In this case the statement forms a unique intersection within a Ben diagram that indicates where you will be taking trades. There is another option however, which is to use an OR operator that simply establishes multiple conditions for which a given signal can be taken. If you replace the AND in the statement before with an OR you will end up with a system that trades in either case (when price crosses the MA or when price is lower the RSI level) which will lead to much higher trading frequencies.

The OR operator is indeed a bundling operator, it makes a single system behave like multiple ones because it stacks the potential conditions that may trigger an event. For example if you have a trading system that enters trades across two conditions then in reality you have two systems, one that uses condition 1 and another that uses condition 2 bundled within a single one. The big danger is that the multiplication of virtual systems within a single trading algorithm brings some important problems. The most important one is the multiplication of the mining bias which comes as a consequence of the great expansion in the degrees of freedom available to take actions.

To better understand this we can do a little experiment. Imagine that you can make a trading system that would look back at X candles before the last candle and using the relationships between them only enter one single trade at last candle’s open in the direction of that candle. this would be a systems that would take a single trade, which would be a profitable trade. Now imagine you do this for every candle in the past 20 years of market history and then bundle the logic of all those systems up with OR operators into a single strategy. You now have a strategy that has no losses, seems to magically always guess market directionality right but is guaranteed to fail in the future due to its degree of mining bias.

This is only possible because we permitted the use of the OR operator within our trading. This can be demonstrated to be impossible using simply AND logical operators because the AND logical operator is restrictive while the OR operator is additive. When you use an AND operator your strategy is expected to take less trades – because you are making the number of conditions that fit the conditional smaller – while the OR operator expands the number of trades that a strategy can take or more generally the way in which a strategy can take trading actions (like exiting trades as well). This additive quality also likely invalidates the use of Monte Carlo simulations to assess trading system risks as inputs participating in OR operators might be correlated, which violates some of the assumptions needed for classic Monte Carlo simulations.

As you can see the OR operator is the equivalent of putting many trading systems into a single one, increasing the mining bias of the resulting strategy exponentially as more conditions with this operator are used. When using automated trading system generators this can lead to a great increase in the data-mining bias, making the resulting strategies practically worthless as they quickly become indistinguishable from those that could be obtained from simply random chance. When using this type of software it is therefore important to avoid using the OR logical operator as it increases the difficult of strategy validation procedures significantly.

The best alternative if you want more complex logic sets is to create individual trading systems separately (without OR logical operators) and then put them together into trading portfolios. Using this you can control the risk and mining bias of the individual elements while obtaining the benefits of combining them later on. If you would like to learn more about portfolio construction and how you too can trade using large arrays of systems please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading.strategies.