Logic is where BloodHound’s power and flexibility come from. Logic nodes combine and shape the raw output of solvers to match your goal, whether that’s entry signals, a filter for another system’s signals, or exit conditions.
Logic nodes
| Node | Output |
|---|---|
| AND | The smallest input value. True only when all inputs are true. |
| OR | The largest input value. True when any input is true. |
| XOR | With two inputs, true only when they differ: one has a signal and the other doesn’t. |
| Ratio | A weighted average of the inputs. Useful when the best balance of influence between criteria is unknown. |
| Additive | The inputs added together. Emulates systems that work on a points or scoring basis. |
| If Then | A switch, controlled by its IF input. |
| Relational | Compares the values at Input A and Input B (A > B, A < B, A = B and so on) for each side. |
A new logic node has one open input on the left and an output on the right. Connect a solver or another node to the input, and another open input appears, so you can connect as many as you need.
Logic primer
BloodHound’s logic is based on fuzzy logic, a natural extension of ordinary (Boolean) logic. In most cases you can design logic just as you would with Boolean logic, and get the results you’d expect.
Boolean logic has three basic operations, AND, OR and NOT, which work just like the words. The examples below use two statements:
- Statement 1: “the slope of the Stochastics D is good”
- Statement 2: “the close is on the good side of the EMA(100)”
To set up solvers for statements like these, see Solvers.
AND and OR
Statement 1 AND Statement 2 is true only if both statements are true.
Statement 1 OR Statement 2 is true if at least one of them is true.
Both can chain any number of statements (called operands): Statement 1 AND Statement 2 AND Statement 3 is true only if all three are true; with OR, any one is enough.
NOT
NOT reverses a statement: if Statement 1 is true, NOT Statement 1 is false. Here, NOT Statement 1 means “the slope of the Stochastics D is not good”.
Fuzzy logic
Fuzzy logic adapts the hard true/false edges of Boolean logic to the messier patterns of the real world. Otherwise it behaves much the same, and a fuzzy system can be set up to work exactly like a Boolean one. Whether you use its extra power is up to you.
The easiest way to think of it: replace “true” with “favorable”, because there are degrees of truth. Solvers and logic nodes output a value from 0 to 1, where 1 is the most favorable. Values like 0.3 (“not very true”) and 0.7 (“fairly true”) are just as valid. For a purely Boolean system, set your solvers to output only 1 (true) and 0 (false).
For example, the solver for Statement 1 might give 0.9 on the Long side when the slope is steeply positive, but 0.7 when it is positive but fairly flat. Statement 1 is still true, just to a lesser degree.
Fuzzy operations
| Operation | Result | Example |
|---|---|---|
| AND | The smallest operand. Favorable only if all operands are. | 0.5 AND 0.7 = 0.5 (“half true”, because Statement 1 is) |
| OR | The largest operand. Favorable if any operand is. | 0.5 OR 0.7 = 0.7 |
| NOT | 1 minus the value. Turns favorable into unfavorable, just as “not” reverses a sentence. | NOT 0.3 = 0.7; NOT 0.85 = 0.15 |
Fuzzy hedges
A hedge changes the meaning of a statement by modifying its value. BloodHound supports two, VERY and SOMEWHAT.
| Hedge | Formula | Effect | Example |
|---|---|---|---|
| VERY | value² | Stricter: only a high value stays favorable. “The slope is very good.” | 0.8² = 0.64 |
| SOMEWHAT | √value | More relaxed: a middling value can pass as favorable. “The slope is somewhat good.” | √0.65 ≈ 0.81 |
NOT and hedges in BloodHound
Select a node on the Logic Board, then in the Property Inspector:
- NOT: click Invert in the Modifiers section of the Properties tab, or use the Inverter function node.
- VERY or SOMEWHAT: choose it under Hedge Operation on the Options tab.
Note
Both apply only to the node you selected on the Logic Board, not to the solver everywhere it is used.