Master this unique indicator in TradingView's Pinescript that combines price action and volume to reveal the true driving force behind market movements.
The Force Index (FI), developed by Alexander Elder, is a unique oscillator that measures the strength of buying and selling pressure by combining price movement and volume. Unlike pure momentum indicators that only consider price, Force Index gives greater significance to large price changes that occur on high volume, indicating a strong force pushing the market. It can be positive (bullish force) or negative (bearish force) and oscillates around a zero line.
In Pinescript, Force Index is a powerful tool for confirming trend strength, spotting potential reversals through divergence, and identifying when strong money is entering or leaving the market.
The core calculation of the Force Index for a single period is quite simple:
//@version=5
indicator("My Force Index Indicator", overlay=false) // overlay=false to plot in a separate pane
// Input for Force Index length (smoothing period for the raw FI)
length = input.int(13, title="FI Length (EMA Smoothing)", minval=1)
// Calculate Force Index using the built-in function
// ta.fi takes the source (usually close) and the length for EMA smoothing
fiValue = ta.fi(close, length)
// Plot the Force Index line
plot(fiValue, title="Force Index", color=color.blue, linewidth=2)
// Plot the Zero Line
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted)
A positive Force Index indicates buying pressure, a negative one indicates selling pressure. The magnitude reflects the strength of that pressure.
//@version=5
strategy("Force Index Trend Confirmation Strategy", overlay=true)
// Input for Force Index length
length = input.int(13, title="FI Length (EMA Smoothing)", minval=1)
// Calculate Force Index
fiValue = ta.fi(close, length)
// Plot the Force Index line in a separate pane
plot(fiValue, title="Force Index", color.blue, display=display.pane_only)
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted, display=display.pane_only)
// Define conditions for entries based on consistent FI direction
// Long when FI is positive and rising
longCondition = fiValue > 0 and fiValue > fiValue[1]
// Short when FI is negative and falling
shortCondition = fiValue < 0 and fiValue < fiValue[1]
// Strategy entries/exits
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
//@version=5
strategy("Force Index Zero Line Crossover Strategy", overlay=true)
// Input for Force Index length (often shorter for crossover signals)
length = input.int(2, title="FI Length (EMA Smoothing)", minval=1)
// Calculate Force Index
fiValue = ta.fi(close, length)
// Plot the Force Index line in a separate pane
plot(fiValue, title="Force Index", color.blue, display=display.pane_only)
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted, display=display.pane_only)
// Define conditions for entries
longSignal = ta.crossover(fiValue, 0)
shortSignal = ta.crossunder(fiValue, 0)
// Strategy entries/exits
if (longSignal)
strategy.entry("Long", strategy.long)
if (shortSignal)
strategy.entry("Short", strategy.short)
//@version=5
indicator("Force Index Divergence Scanner", overlay=true)
// Input for Force Index length
length = input.int(13, title="FI Length (EMA Smoothing)", minval=1)
// Calculate Force Index
fiValue = ta.fi(close, length)
// Plot Force Index in a separate pane
plot(fiValue, "Force Index", color.blue)
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted)
// Simple divergence detection (conceptual, robust detection requires advanced pivot logic)
// This is a simplified example focusing on price vs FI divergence.
// Bullish Divergence (Price lower low, FI higher low)
bullishDivergence = close[2] > close[1] and close[1] > close and fiValue[2] < fiValue[1] and fiValue[1] < fiValue
// Bearish Divergence (Price higher high, FI lower high)
bearishDivergence = close[2] < close[1] and close[1] < close and fiValue[2] > fiValue[1] and fiValue[1] > fiValue
plotshape(bullishDivergence, title="Bullish Divergence", location=location.belowbar, color=color.new(color.green, 0), style=shape.triangleup, size=size.small)
plotshape(bearishDivergence, title="Bearish Divergence", location=location.abovebar, color=color.new(color.red, 0), style=shape.triangledown, size=size.small)
alertcondition(bullishDivergence, "Bullish FI Divergence", "Potential bullish reversal based on Force Index divergence.")
alertcondition(bearishDivergence, "Bearish FI Divergence", "Potential bearish reversal based on Force Index divergence.")
To get the most from the Force Index in Pinescript:
The higher the Force Index, the stronger the bullish force. The lower (more negative) the Force Index, the stronger the bearish force. Volume is the key differentiator here.
The Force Index is a unique and highly insightful technical indicator in Pinescript for TradingView. Its integration of both price change and volume provides a powerful measure of the underlying buying and selling pressure in the market. Whether used for confirming trend strength, identifying momentum shifts through zero-line crossovers, or spotting potential reversals via divergence, the Force Index offers valuable insights. By understanding its calculation, thoughtfully tuning its parameters, and integrating it strategically with other technical analysis tools, you can leverage the Force Index to gain a deeper, volume-confirmed perspective on market dynamics and enhance your trading decisions.
Get a high-performance Pinescript analysis tool for actionable market insights, designed for traders on the move.
This strategy runs in live mode on TradingView, helping you identify potential opportunities.
Get Pinescript Strategy