Difference Between

The Difference Between rule calculates the numeric difference between two values by subtracting Value 2 from Value 1. This straightforward utility rule is useful whenever you need to measure the gap, spread, or distance between two numeric outputs in your strategy.

How It Works

The Difference Between rule accepts two numeric inputs and computes their difference using the formula: Value 1 minus Value 2. The result can be positive, negative, or zero depending on the relative magnitudes of the two inputs. A positive result indicates that Value 1 is larger than Value 2, while a negative result indicates the opposite.

This rule is commonly used to measure the spread between two price levels, the gap between two indicator readings, or the distance between a current value and a reference point. Connect the output to other rules such as Compare Switch or Simple Calculator for further processing, or feed it directly into a condition-based rule to trigger actions based on the magnitude of the difference.

Inputs

Input Type Required Description
Value 1 Number Yes The first numeric value (minuend). This is the value from which Value 2 will be subtracted.
Value 2 Number Yes The second numeric value (subtrahend). This value is subtracted from Value 1.

Outputs

Output Type Description
Value Number The calculated difference (Value 1 − Value 2). Can be positive, negative, or zero.

Tips

Use Difference Between to calculate the spread between bid and ask prices, the gap between two moving averages, or the distance from the current price to a support or resistance level. If you need the absolute distance regardless of direction, connect the output to a Simple Calculator rule with the absolute value option enabled.

Was this helpful? Let us know