Positivity Indicator
The Positivity Index is an indicator that quantifies bullish or bearish sentiment by measuring the percentage of positive price changes over a specified period. It provides a clear percentage-based view of market sentiment, ranging from -1 (all periods negative) to 1 (all periods positive).
About the Positivity Indicator
The Positivity Indicator is a momentum indicator that quantifies bullish or bearish sentiment by measuring the percentage of positive price changes over a specified period. Unlike traditional momentum oscillators that measure the magnitude of price changes, the Positivity Index focuses purely on the direction of movement, providing a clear percentage-based view of market sentiment.
What It Measures
The Positivity Indicator measures the percentage of periods where the closing price was higher than the previous period's close over a specified lookback window. It provides a directional momentum metric that ranges from 0% (all periods negative) to 100% (all periods positive).
When to Use
- Trend Identification: Values consistently above 0 suggest bullish trends; below 0 suggest bearish trends
- Momentum Confirmation: High readings (0.7) confirm strong bullish momentum; low readings (-0.7) confirm bearish momentum
- Overbought/Oversold Conditions: Extreme readings can signal potential reversals in mean-reverting markets
- Divergence Analysis: Compare Positivity Indicator with price to identify potential trend changes
- Market Sentiment: Quantify the prevailing directional bias in the market
Example Usage
use centaur_technical_indicators::other_indicators::bulk::positivity_indicator;
use centaur_technical_indicators::ConstantModelType;
pub fn main() {
// fetch the data in your preferred way
// let open = vec![...]; // open prices
// let previous_close = vec![...]; // previous close prices
let signal_period = 14;
let model = ConstantModelType::SimpleMovingAverage;
let positivity = positivity_indicator(&open, &previous_close, signal_period, model);
println!("Positivity Indicator: {:?}", positivity);
}
from centaur_technical_indicators.other_indicators.bulk import positivity_indicator
# fetch the data in your preferred way
# open = [...] # open prices
# previous_close = [...] # previous close prices
signal_period = 14
model = "simple_moving_average"
positivity = positivity_indicator(open, previous_close, signal_period, model)
print(f"Positivity Indicator: {positivity}")
import init, {
other_bulk_positivityIndicator,
ConstantModelType
} from 'https://cdn.jsdelivr.net/npm/centaur-technical-indicators@latest/dist/web/centaur-technical-indicators.js';
await init();
// fetch the data in your preferred way
// const open = [...]; // open prices
// const previousClose = [...]; // previous close prices
const signalPeriod = 14;
const model = ConstantModelType.SimpleMovingAverage;
const positivity = other_bulk_positivityIndicator(open, previousClose, signalPeriod, model);
console.log('Positivity Indicator:', positivity);