Chart Patterns, Truth Tables, & Boolean Algebra

2 replies to this topic

#1 borland

borland

Member

• 276 posts

Posted 29 September 2009 - 05:48 PM

First….Disclaimer: I dreamed this stuff up, so you won’t likely see this used by traders elsewhere.….

Here’s an approach for trade strategy development using chart pattern recognition in multiple timeframes. In this example, I’m identifying stochastic indicator patterns in two timeframes or chart periods. Take a look at these Daily and 60 minute period charts.

For the %K (fast line), I’ve annotated the patterns by letters A-H. Each pattern can be described mathematically using indicator values for only one or two periods or bars.

Stochastic indicators are a great measure of price momentum, but less reliable when in the overbought (80%) or oversold (20%) condition, and when so, it’s usually a good idea to shift trading to shorter intervals using a shorter timeframe stochastic. The idea being…”let your profits run until overbought, then look for a good exit”. This logic can be demonstrated in tabular format for two timeframes.

By identifying which patterns provide the best trade entry and exits, rules for trading can be established (A complete trade strategy will includes a set of rules, that when combined, can be expressed mathematically using Boolean algebra. This is just an example of an approach to pattern recognition, not a complete trade strategy solution.

Take a look at this table which maps out the patterns and rules that can be expressed using Boolean algebra.

The table identifies 8 chart patterns or variables. Not all possible combinations are listed; for simplifications reasons it only identifies acceptable entry and exits. Using deductive reasoning or Boolean algebra, it’s possible that these 30 possible cases (9 entry and 21 exits) can be simplified into fewer cases.

Need a refreaher on Boolean algebra? Here’s short video at eHow.com Short Video Boolean Algebra

You might recall my MACD guide post here on TT a while ago. Look here…Guide To MACD and Price Strength A similar table for MACD & EMA chart patterns was provided, but I only hinted at a shortcut for the simplification method.

From the chart pattern table above, I’ve constructed a truth table for the trade entry logic only.

At the bottom, the truth table is expressed mathematically in Boolean algebra, where the ‘+’ sign notation represents a logical OR and the ‘|’ in front of some variables is a logical negation (e.g., |AB = A is not true, but B is true ).

Boolean algebra can be used to simplify the equation but may require some work. Here’s a simplification example at eHow.com with a truth table of only three variables. How to Convert Boolean Algebra

Greater than three variables usually requires other simplification methods….

Searching the web, I found a freeware software solution called the Karnaugh Map Minimizer Ver 0.4 by Robert Kovacevic. Here’s a screenshot, populated with my truth table and showing the simplification solution.

Problem is, due to programming errors in the application, it gives an incorrect simplified solution. I’ve tested the program on 3 variables with success. There are a few other similar software applications to try, maybe later. The computer has no problem with the complex logic or running redundant conditional tests on many technical indicators. But code readability is easier with trade logic simplified. It will also make code modifications easier.

#2 Not Too Swift

Not Too Swift

Member

• 2,089 posts

Posted 29 September 2009 - 07:59 PM

Very cool idea. Thanks!
I let the market tell me what to do. The trouble is she mumbles a lot, and I'm hard of hearing.

1576 ONO. Upside down, reverse, inside out, snort...

macavity

Member