Skip to content
Black Friday: sale starts November 15th.

Ratio Node

Ratio node

The Ratio node outputs a weighted average of its inputs. Use it when your criteria should each contribute, but you don’t know the best balance between them, or a weakness in one can be made up by another.

It suits fuzzy logic systems, where solvers output values between 0 and 1. It works like a discretionary trader weighing up several factors, some stronger than others, before taking a trade. Each input’s weight is its Multiply Output value, set on that solver’s Options tab (Weight).

How it works

Each input’s value is multiplied by its weight, the results are added up, and the total is divided by the sum of the weights. The Long output uses the inputs’ Long values and the Short output uses their Short values, each calculated separately.

Output = (value 1 × weight 1 + value 2 × weight 2 + …) ÷ (weight 1 + weight 2 + …)

With every weight at 1 (the default), the output is the plain average of the inputs.

Example

Four criteria, each a solver, where you want to fine-tune how much each one counts.

  1. Add the four solvers and a Ratio node to the Logic Board, connect each solver to the Ratio node, and connect the Ratio node to the Result node. The chart now shows a blend of all four.
  2. To make criterion 1 count twice as much as the others, select its solver on the Logic Board, open the Options tab, and set Multiply Output to 2.
  3. BloodHound updates the chart right away, so you can adjust the weights and check the result until you’re happy.

With these weights:

InputWeight (Multiply Output)
11.5
22
30.5
41

the output on each bar is (value 1 × 1.5 + value 2 × 2 + value 3 × 0.5 + value 4 × 1) ÷ (1.5 + 2 + 0.5 + 1), that is, divided by 5.

Example video

From the weekly workshop, January 2017.

Properties tab

Property Inspector tabs, with the Properties tab selected

The essential settings for the node.

Modifiers

Buttons for the most common output modifiers. They change only the selected instance of a node on a Logic Board, so they appear only when a node is selected there, not when a solver is selected in the Solvers panel. That keeps the solver’s original output unchanged everywhere else it’s used, much like changing an SMA’s plot color on one chart leaves it unchanged on your other charts.

Modifiers: the Enabled, Invert and Swap buttons
ButtonWhat it does
EnableTurns the node on or off. When it’s off, the node is left out of the system’s calculations. It still looks connected on the Logic Board, but it’s ignored.
InvertInverts the node’s output. The same calculation as the Inverter function node, without its extra options.
SwapSwaps the outputs: Long becomes Short and Short becomes Long. The same as the Long/Short Modifier function node with Mode: Swap.

Options tab

Property Inspector tabs, with the Options tab selected

Secondary settings shared by all nodes.

Weight

Changes the node’s final output value. Only needed when designing a fuzzy logic system, or a fuzzy logic part of a system.

How Weight works

Weight changes only the selected instance of a node on a Logic Board. So the controls appear only when a node is selected there, not when a solver is selected in the Solvers panel: a solver’s original output can’t be changed globally.

ControlWhat it does
Multiply OutputMultiplies the node’s internal Long and Short values (set by the Output Rules on the Properties tab) by this number. The final output still can’t go above 1 (see Slider).
SliderLimits the final output to between 0 and 1. The left handle sets a minimum output, given whether or not the condition is true. The right handle sets the maximum; the output is capped there.
Hedge OperationApplies a formula to the internal value.
None: unchanged.
Very: squares it (value²).
Somewhat: takes the square root (√value).

Example: two out of three

Three solvers check three indicator conditions, but only two need to be true. Connect them to an Additive logic node and set each solver’s maximum (the slider’s right handle) to 0.5. When any two are true, the Additive node adds 0.5 + 0.5 + 0 = 1, which means the two-out-of-three condition is met.

Description

Free text for describing what the node does or what it’s for. The Description is shared by every instance of the node, unlike Weight, which is set per instance.

Help tab

Property Inspector tabs, with the Help tab selected

Shows this page for the selected node, inside BloodHound. Click the node’s image at the top of the page to open it in a bigger window. The built-in web viewer needs NinjaTrader 8.0.26.0 or newer.

Still stuck? Contact support