Wilder Swing Index (SI)
Summary
Wilder's Swing Index: one number rating each bar against the bar before it, from both bars' open and close and the current bar's high and low, signed by the direction of the swing. A strong close above the prior close on a wide range reads high and positive, a strong down swing reads high and negative. It is scaled against the limit move, the largest one-bar move the market allows, and stays between -100 and +100 while every move is within that limit. J. Welles Wilder Jr. introduced it in 1978 and trades its running total, ASI.
Chart
Chart metadata i
Outputs
outReal:line·zero·positive·negative
Formula
where , , , , and is optInLimitMove (Wilder writes it ).
Notes
- Wilder rounds each value to a whole number when working by hand; the output is not rounded.
- A bar that moves more than the limit move can read beyond -100 or +100; the output is not clamped.
Inputs
inOpen— Open price of each barinHigh— High price of each barinLow— Low price of each barinClose— Close price of each bar
Outputs
outReal— Swing index of the bar against the previous bar
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInLimitMove | real | 3 | ≥ 0.00000001 | Limit move, the largest one-bar price move the index is scaled against, in price units |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ☐ Uses Transcendental |
| ☐ Input Must Be Positive |
Example
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double open[252]; /* your data, oldest first */
double high[252]; /* your data, oldest first */
double low[252]; /* your data, oldest first */
double close[252]; /* your data, oldest first */
double out[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_SI( 0, n - 1, open, high, low, close, 3.0, &outBegIdx, &outNBElement, out );
printf( "%d values from bar %d; last out = %f\n", outNBElement, outBegIdx, out[outNBElement - 1] );use ta_lib::Core;
let open = vec![0.0; 252]; // your data, oldest first
let high = vec![0.0; 252]; // your data, oldest first
let low = vec![0.0; 252]; // your data, oldest first
let close = vec![0.0; 252]; // your data, oldest first
let mut out = vec![0.0; 252];
let core = Core::new();
let range = core.si(0, open.len() - 1, &open, &high, &low, &close, 3.0, &mut out)?;
println!("{} values from bar {}; last out = {}", range.count, range.beg_idx, out[range.count - 1]);import io.github.talib.Core;
import io.github.talib.OutRange;
double[] open = new double[252]; // your data, oldest first
double[] high = new double[252]; // your data, oldest first
double[] low = new double[252]; // your data, oldest first
double[] close = new double[252]; // your data, oldest first
double[] out = new double[252];
Core core = Core.DEFAULT;
OutRange r = core.si(0, open.length - 1, open, high, low, close, 3.0, out);
System.out.println(r.count() + " values from bar " + r.begIdx() + "; last out = " + out[r.count() - 1]);using System;
using TALib;
var open = new double[252]; // your data, oldest first
var high = new double[252]; // your data, oldest first
var low = new double[252]; // your data, oldest first
var close = new double[252]; // your data, oldest first
var outReal = new double[252];
var core = Core.Default;
OutRange r = core.Si(0, open.Length - 1, open, high, low, close, 3.0, outReal);
Console.WriteLine($"{r.Count} values from bar {r.BegIdx}; last outReal = {outReal[r.Count - 1]}");import { si } from 'ta-lib';
const open = new Float64Array(252); // your data, oldest first
const high = new Float64Array(252); // your data, oldest first
const low = new Float64Array(252); // your data, oldest first
const close = new Float64Array(252); // your data, oldest first
const { begIdx, values } = si({ open, high, low, close }, { limitMove: 3 });
console.log(values.length + ' values from bar ' + begIdx + '; last values = ' + values[values.length - 1]);Implementation
Added in 0.8.3 (ta-lib-python 0.8.3).
TA-Lib Definition: si.c · si.yaml
| Native | File |
|---|---|
| C | ta_SI.c |
| Rust | si.rs |
| Java | Core_SI.java |
| C# | Core_SI.cs |
| TypeScript | si.ts |
Python: talib.SI (ta-lib-python 0.8.3 or later), see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
See Also
References
- J. Welles Wilder Jr., New Concepts in Technical Trading Systems, Trend Research, 1978, section VIII "The Swing Index", pp.87-106