Swing
Description
The Swing indicator will plot lines that represent the swing points based on the strength (number of bars to the left and right of the swing point) parameter provided, it’s mostly a visual tool and not meant to be predictive in nature. Only after the strength number of bars has passed since the extreme point, the swing return value could be definitely set, thus the indicator updates its calculations as new incoming data warrants so.
You can access methods within this indicator to determine the number of bars ago a swing point occurred or the current swing value.
Tip: To workaround the situation, where the indicator has to recalculate - you could only access the SwingHigh / Low values the number of swing strength bars ago - those values are calculated in their final state.
Syntax - Bars Ago
High Bar
Swing(int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod)
Swing(ISeries\<double\> input, int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod)
Low Bar
Swing(int strength).SwingLowBar(int barsAgo, int instance, int lookBackPeriod)
Swing(ISeries\<double\> input, int strength).SwingLowBar(int barsAgo, int instance, int lookBackPeriod)
Return Value
An int value representing the number of bars ago. Returns a value of -1 if a swing point is not found within the look back period.
Syntax - Value
High Value
Swing(int strength).SwingHigh[int barsAgo]
Swing(ISeries\<double\> input, int strength).SwingHigh[int barsAgo]
Low Value
Swing(int strength).SwingLow[int barsAgo]
Swing(ISeries\<double\> input, int strength).SwingLow[int barsAgo]
Return Value
double; Accessing this method via an index value [int barsAgo] returns the indicator value of the referenced bar.
- A return value of 0 (zero) will be returned if the CurrentBar number is less than the “strength” value, or a swing pivot has not yet been found.
Parameters
Examples
Source Code
You can view this indicator method source code by selecting the menu New > NinjaScript Editor > Indicators within the NinjaTrader Control Center window.

