pub fn williams_percent_r(close: f64, high: f64, low: f64) -> Result<f64> {
	if high < low {
		return Err(AnalysisError::HighLessThanLow);
	}
	if close > high {
		return Err(AnalysisError::CloseGreaterThanHigh);
	}
	if close < low {
		return Err(AnalysisError::CloseLessThanLow);
	}
	Ok(match high == low {
		true => -50.,
		false => -100. * (high - close) / (high - low),
	})
}
/// Williams %R is a momentum indicator developed by Larry R. Williams that
/// is the inverse of the stochastic oscillator. It reflects the level of the
/// value relative to the high. The output of the function oscillates between
/// -100 and 0.
///
/// Typical number of periods and signal lines used with the stochastic
/// oscillator are also applicable to Williams %R.
///
/// `high` and `low` arguments are the highest high and the lowest low
/// respectively for the used period.
///
/// The formula is modified to return -50 if the highest high equals the
/// lowest low.
///
/// # Arguments
///
/// * `close` - closing price for the period
/// * `high` - highest price for the period
/// * `low` - lowest price for the period
///
/// # Example
///
/// ```
/// use stat::analysis::momentum;
///
/// let value = momentum::williams_percent_r(80., 90., 50.);
/// assert_eq!(value.ok(), Some(-25.));
/// ```
Williams %R is a momentum indicator developed by Larry R. Williams that
is the inverse of the stochastic oscillator. It reflects the level of the
value relative to the high. The output of the function oscillates between
100 and 0.

Typical number of periods and signal lines used with the stochastic
oscillator are also applicable to Williams %R.

`high` and `low` arguments are the highest high and the lowest low
respectively for the used period.

The formula is modified to return -50 if the highest high equals the
lowest low.
Williams %R is a momentum indicator developed by Larry R . Williams that is the inverse of the stochastic oscillator . It reflects the level of the value relative to the high . The output of the function oscillates between 100 and 0 . Typical number of periods and signal lines used with the stochastic oscillator are also applicable to Williams %R . ` high ` and ` low ` arguments are the highest high and the lowest low respectively for the used period . The formula is modified to return - 50 if the highest high equals the lowest low .
pub fn williams_percent_r(close: f64, high: f64, low: f64) -> Result<f64> {
	if high < low {
		return Err(AnalysisError::HighLessThanLow);
	}
	if close > high {
		return Err(AnalysisError::CloseGreaterThanHigh);
	}
	if close < low {
		return Err(AnalysisError::CloseLessThanLow);
	}
	Ok(match high == low {
		true => -50.,
		false => -100. * (high - close) / (high - low),
	})
}
pub fn williams_percent_r ( close : f64 , high : f64 , low : f64 ) -> Result < f64 > { if high < low { return Err ( AnalysisError :: HighLessThanLow ) ; } if close > high { return Err ( AnalysisError :: CloseGreaterThanHigh ) ; } if close < low { return Err ( AnalysisError :: CloseLessThanLow ) ; } Ok ( match high == low { true => - 50. , false => - 100. * ( high - close ) / ( high - low ) , } ) }
Williams %R is a momentum indicator developed by Larry R. Williams that
is the inverse of the stochastic oscillator.
Williams %R is a momentum indicator developed by Larry R . Williams that is the inverse of the stochastic oscillator .
close
f64
high
f64
low
f64
example
```
use stat::analysis::momentum.


` ` ` use stat :: analysis :: momentum .