The Acceleration indicator measures the rate of change in the velocity of price movements. It helps identify potential reversals, continuations, or changes in market momentum. A high acceleration indicates strong market momentum, while low or negative acceleration can signal slowing momentum or potential trend reversals.
const period = 14; // The lookback period for the acceleration calculation
const acceleration = new I.Acceleration([period]);
period
(Integer):
period
of 14 calculates acceleration over the last 14 data points.The Acceleration
object provides a series of values representing the acceleration of price movements for each data point. Initial values may be undefined
if the data points are insufficient to calculate acceleration for the specified period
.
The Acceleration indicator is derived using the following steps:
period
.
n
periods ago) / n
.t
- Velocity at t-1
).const period = 14; // Calculate acceleration over 14 periods
const acceleration = new I.Acceleration([period]);
console.log(acceleration); // Outputs an array of acceleration values
Use acceleration to assess market momentum changes:
const iv = HFS.indicatorValues(state);
const accelValue = iv.accel; // Latest acceleration value
if (accelValue > 0) {
console.log("Positive acceleration: Market momentum is increasing.");
} else if (accelValue < 0) {
console.log("Negative acceleration: Market momentum is decreasing.");
} else {
console.log("Neutral acceleration: No significant change in momentum.");
}