Risk Disclosure

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View full risk disclosure.

Logic Templates

The Logic template system is where the real power and flexibility of BloodHound exists.  With logic you can manipulate the raw putput produced from solvers and create constructs that produce outputs to match your specific goals – be it: specifying entries for trading, filtering existing signals from another system, or even identifying exit conditions.  How you ultimately use BloodHound is up to you, the power given to you by the Logic template system allows you to implement literally anything of the imagination.

Navigating The Workspace

You can pan around the Logic template workspace (green work area) by using the middle mouse button (typically the wheel on your mouse).  By click-dragging with the middle mouse button you can pan around the workspace.  Alternatively, you can click the hand icon to toggle panning mode on or off.  Now left clicking on the workspace will allow you to pan around.  Lastly, to zoom in and out, use the mouse wheel.

Working with Nodes

To start working with the Logic template workspace, first navigate to the Logic tab.  Before you start, you will need to add a new Logic template by clicking the *New button.  You’ll notice two important menus below: Solver Nodes and Logic Nodes, each of these menus list the node objects that can be added to the logic workspace area below.

You can move nodes around the workspace as you wish by click dragging them individually, or selecting several of them by first clicking on an empty spot and dragging the selection box over the nodes you want to select.  Notice that when you select a single node, the right hand sidebar updates with information on their contents.

Connecting Nodes

Solvers that you have added earlier (in the Solvers tab) will each appear under the Solver Nodes menu (and also the bottom of the context menu, which is shown when you right click the workspace).  You will notice that when you have added a solver node to the workspace, it will appear, along with a single green dot labeled Output.  This dot represents the output connector from the node.

There are also a number of logic nodes: AND, OR, Ratio and Additive Nodes.  These can be added in a similar manner.  You will also notice after adding any of these nodes that there is an Inputconnector and an Output connector.  Generally speaking, you create meaningful logic by connecting the output of these solver nodes to the input of the logic nodes.  To do this, simply mouse over the node you want to wire data from (for instance a solver node) and by click drag to the node you want to wire data to (the destination node, typically a logic node).

Finally you will also notice a special node already present on the workspace labelled the ResultNode.  This is where you connect your final logic output to.

Deleting Nodes and Connections

Connections can also be deleted by mousing over the line connecting two nodes.  You will notice that an X appears.  Clicking this red X deletes the connection.  Similarly nodes themselves can be deleted by clicking the red X button in the top right corner of the node, or by hitting the DEL key on the keyboard when the node is selected.

Logic Primer

BloodHound’s logic template system is based on fuzzy logic.  If you are familiar with Boolean logic, fuzzy logic is a very natural extension of Boolean logic, and in many cases you can design logic constructs in much the same way you would regular Boolean logic and get the results you would otherwise expect.

Boolean logic uses a few fundamental operations from which it is possible to create any possible combination of logic statements.  They are: AND, OR and NOT.  Even if you are not familiar with these logical operators they are easy to understand, as they function exactly like their names.

For the purposes of constructing an example we will consider the two statements

1. Statement 1: “slope of the Stochastic D Indicator is good”
2. Statement 2: “closing price is on the good side of the EMA(100)”

For information on how we can configure Solvers to emulate these statements, see the Confidence Solver overview.

AND and OR

AND will only result to true when both statements (called operands) are also true. Thus in the example above, if we labeled “slope of the Stochastic D Indicator is good” statement 1, and “closing price is on the good side of the EMA(100)” as statement 2:

Statement 1 AND Statement 2 is true, if and only if Statement 1 is true, and Statement 2 is true.

Similarly for OR:

Statement 1 OR Statement 2 is true if and only if at least one of the statements are true.

Both AND and OR can also chain together multiple operands, and the result is basically what you would expect if you were to describe it in natural language. For example: Statement 1 AND Statement 2 AND Statement 3 is true if and only if all statements (1 through 3) are true. Similarly Statement 1 OR Statement 2 OR Statement 3 is true if and only if any one of the statements are true.

NOT

A logic NOT operation reverses the statement from true to false, and false to true. Thus in our example, if the Statement 1 is true, than NOT Statement 1 is false.

NOT works as intuitively as you might expect. If you consider that Statement 1 was defined as “slope of the Stochastic D Indicator is good”, then NOT Statement 1 can be thought of as: “slope of the Stochastic D Indicator is not good”.

Fuzzy Logic

As you may have seen previously, BloodHound works with an extension of Boolean logic known as fuzzy logic. It was designed by mathematicians with the goal of adapting the hard digital edges of the logical systems to fit the more organic and chaotic patterns of the real world. Aside from that, fuzzy logic behaves much the same way and indeed it is possible to create a fuzzy logic system that works identically to a regular logic system. Thus by extension, you may choose to take full advantage of BloodHound’s fuzzy logic capability or not. The choice is up to you.

With fuzzy logic, there are some subtle differences in the interpretation of “true”. The easiest way to conceptualize fuzzy logic (in the context of BloodHound) is to substitute the word “true” with “favorable”, since there are actually degrees of truth in a fuzzy logic system. If you recall, solvers and logic nodes in BloodHound output a value between 0 and 1.0, 1.0 being the most favorable value (or the highest degree of truth). Decimal numbers such as 0.3 or 0.7 are just as valid in a fuzzy logic system and can be interpreted to represent “not so true” and “substantially true” respectively. In contrast, to use a purely digital approach like a regular logic system, you would abandon decimal values and configure your solvers to output only 1’s (true) and 0’s (false).

In our previous example with the two statements in the previous section, the solver that evaluates Statement 1 may produce a high number during the long evaluation, say 0.90 if the slope is steeply positive. But it is more than possible to configure the solver to give you a lower value, say 0.70 if the slope is relatively flat (but still positive). In that case, Statement 1 is still “true” but to a lesser degree.

Fuzzy AND

For a fuzzy logic AND, the result is only favorable if all the statements (called operands) are also favorable. In fact a fuzzy logic AND is the minimum value from all operands. So if the solvers from Statement 1 and Statement 2 were producing 0.5 and 0.7 respectively, an AND node connected to both statements would produce a 0.5. This generally means that the at best Statement 1 AND Statement 2 is only “half true” or “partially favorable”, because Statement 1 was only “partially favorable”.

As before, you can chain to together AND statements. Consider:

Statement 1 AND Statement 2 AND Statement 3 AND Statement 4.

This will only be favorable if and only if all of the statements are favorable.

Fuzzy OR

The fuzzy OR  works very similar to the fuzzy AND except the result is only favorable if any of the operands have a favorable value. Mathematically a fuzzy logic OR is simply the maximum value of all inputs. This ensures the highest input value is represented in the output. Similar to the fuzzy AND, you can also chain multiple OR statements together, and the result will work as expected, that is if any one of the statements are favorable, your overall result will be favorable.

Fuzzy NOT

Fuzzy NOT takes the operand and performs an inversion of the value, which is to take the value and subtract it from 1.0.  Thus a relatively low value of 0.3 becomes a much higher value of 0.7 (derived from 1.0 -0.3).  Similarly, a value of say 0.85 becomes a relatively low value of 0.15 (1 -0.85).

If you pause to think about this: inverting a once high value into a low value makes sense. Fuzzy NOT inverts a favorable value into an unfavorable value, just as the word “not” inverts the meaning of a statement in natural language.

Fuzzy Hedges

Aside from standard logic operations, fuzzy logic allows you alter the meaning of a statement (represented by a fuzzy value) by simply modifying the value. This modification is known as a fuzzy hedge. We will now discuss the 2 fuzzy hedges supported by BloodHound: VERY and SOMEWHAT.

Fuzzy Very

Consider the statement from our previous value: “slope of the Stochastic D Indicator is good”. Suppose you wanted to make your criteria more stringent, that is you are looking for a “very good” slope before taking a trade. For the purposes of simplicity, let us suppose that the steeper the slope in a given direction, the more favorable it is for your trading system. Thus to arrive at a very good slope we would be looking for a very steep slope.

In order to ensure that only a very good slope is observed, we must deflate the values by squaring them. This will ensure that only a very high value results in favorable value. Thus the fuzzy hedge for VERY is achieved by squaring the original value. For example, if we had a value of 0.8 (a relatively high value) for statement 1, then VERY Statement 1 (in our example this would mean: “slope for the Stochastic D Indicator is very good”) would be:

$0.8^2=0.64$

As you can see a very high number would have to suffice for a favorable outcome of VERY Statement 1.

Fuzzy Somewhat

In contrast to VERY, fuzzy hedge SOMEWHAT performs the opposite modification. It is used when you need to relax the criteria of your statement so that mediocre values are can pass as favorable.

This is achieved by square-rooting the original value. In our example, suppose that Statement 1 produced a value of 0.65 (a relatively mediocre value). Then SOMEWHAT Statement 1 would be calculated by:

$sqrt{0.65}=0.81$

In our previous example, this can be interpreted as: “slope of Stochastic D is somewhat good”. The hedge SOMEWHAT has taken the mediocre value of 0.65 and turned it into the relatively high value of 0.81, allowing it to pass as a relatively favorable value.

BloodHound’s Logic Nodes

BloodHound comes with both the AND and OR logic nodes, as well as two special Ratio and Addition logic nodes for fuzzy logic manipulation.

You will notice that when you add this node to the node workspace, there will be one open input connection on the left hand side, and an output connection on the right hand side.

The inputs are considered operands, and you can connect a solver directly to this connection or the output from another logic node. As you connect other nodes to this node, you will notice that another open input connection appears, allowing you to connect as many inputs to this node as you desire.