SwingLowBars

Top  Previous  Next

Finds the swing low bar.

 

Syntax

 

barLookbackIndex = SwingLowBar( 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 low 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 higher 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 higher 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 number of bars back from the offset starting index of the swing bar. Returns -1 if not found.

 

Example

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

' Check the last 500 bars.

 

swingBar = SwingLowBar( instrument.low, 2, 4, 5, 500 )

 

' Print the date of the swing bar.

PRINT instrument.date[ swingBar ]

 

 

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