Highest Price
The Highest Price rule tracks and captures the highest price from a stream of incoming price data. It continuously monitors price inputs and maintains a record of the maximum price reached, enabling your strategies to make decisions based on peak price levels within a specified lookback window or across the entire data history.
How It Works
The Highest Price rule continuously processes a stream of price inputs and identifies the highest price value among them. It operates in two modes based on the lookback period setting:
- Unlimited Lookback (All-Time High): When the lookback period is set to 0, the rule tracks the highest price across all historical inputs, effectively creating a running maximum that only increases when new higher prices are received. This is useful for tracking overall peak values since the strategy began.
- Limited Lookback (Rolling Window): When the lookback period is set to a specific number (for example, 10), the rule only considers the most recent 10 price inputs when determining the highest value, creating a sliding window of price analysis. As older values fall outside the window, the highest price may decrease if those older values were the previous maximum.
The rule provides two configurable execution options that control when and how frequently it fires:
Execute on Changes Only: When enabled, the rule only outputs a result when the highest price within the lookback period changes. This prevents unnecessary downstream rule executions when the highest price remains stable. When disabled, the rule outputs the current highest price on every input regardless of whether it has changed.
Latest Price is Highest: When enabled, the rule only executes if the most recently received price is the highest in the lookback period, making it ideal for triggering actions only when new price highs are reached. When disabled, the rule executes whenever the highest price changes, regardless of whether the change was caused by the latest input or by an old value falling out of the lookback window.
This rule is particularly useful for breakout strategies, resistance level detection, trailing stop calculations, and any strategy that needs to respond when prices reach new highs within a specific period.
Inputs
| Parameter | Description | Required | Default |
|---|---|---|---|
| Price | The latest price input to be compared with previous prices to determine the highest price. This is the new price value that gets added to the analysis on each evaluation. | Yes | — |
| Lookback Period | The number of recent price inputs to consider when determining the highest price. Set to 0 for unlimited lookback (all-time high), or a positive number for a rolling window. For example, a value of 5 considers only the most recent 5 price inputs. | No | 0 |
| Latest Price is Highest | Controls when the rule executes. When true, the rule only fires if the most recently received price is the highest in the lookback period. When false, the rule fires whenever the highest price changes for any reason. | Yes | true |
| Execute on Changes Only | Controls execution frequency. When true, the rule only fires when the highest price in the lookback period changes. When false, the rule fires on every price input even if the highest price has not changed. | Yes | true |
Outputs
| Output | Description |
|---|---|
| Highest Price | The highest price value identified within the specified lookback period based on the configured criteria. This value updates as new highs are reached or as old highs fall outside the rolling window. |
Tips
Use an unlimited lookback (period 0) when you need to track the absolute highest price since the strategy started—perfect for calculating trailing stops from the all-time high. Use a limited lookback when you need a rolling high, such as tracking the highest price over the last 20 data points for dynamic resistance levels. Enable “Latest Price is Highest” when you only want to trigger actions at the moment a new high is reached, which is ideal for breakout strategies.
Was this helpful? Let us know