SwingHigh

Top  Previous  Next

Finds the swing high value.

 

Syntax

 

swingValue = SwingHigh( series, [occurrence], [forwardStrengthBars], [backwardStrengthBars], [lookbackBars], [offsetBars] )

 

Parameters

series

 

the series to use

occurrence

 

the occurrence to look for. Default is the first occurrence of this swing high back from the current bar. A value of 2 will find the second occurrence back, etc.

forwardStrengthBars

 

the number of bars forward to check for a given bar to determine if a swing occurred. Default is to check one bar. If all forwardStrengthBars are lower than the bar, then the swing occurred. If any are equal, then the swing did not occur. Flat tops are ignored.

backwardStrengthBars

 

the number of bars backward to check for a given bar to determine if a swing occurred. Default is to check forwardStrengthBars number of bars. If all backwardStrengthBars are lower than the bar, then the swing occurred. If any are equal, then the swing did not occur. Flat tops are ignored.

lookbackBars

 

the total number of bars to check for a swing. Default is to use all available bars.

offset

 

the number of bars to offset before finding the value. The default is 0, using the current bar.

 

 

 

returns

 

the swing value. Returns -1 if not found.

 

Example

' Find the second occurrence back where the post 4 and prior 5 bar values were lower than the current value.

' Check the last 500 bars.

 

swingValue = SwingHigh( instrument.high, 2, 4, 5, 500 )

 

 

 

This example shows the use of the common auto indexed series. For information on using functions with non auto indexed series review Series Functions.