Finds the swing high bar.

 

This example shows the use of the common auto indexed series.

 

For information on using functions with non auto indexed series review Series Functions.

 

Syntax:

SwingHighBar(series,[occurrence],[forwardStrengthBars],[backwardStrengthBars],[lookbackBars],[offsetBars])

 

Parameter:

Description:

series

Series name to use

[occurrence]

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]

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]

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]

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

[offsetBars]

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

 

Example:

'  Checks the last 500 bars from the current bar location.

 

'  Find the second occurrence back where the later 4

'  and prior 5 bar values were lower than the current value.
swingBar = SwingHighBar( instrument.high, 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.

Returns:

Function value returns a positive integer number that represent the bar offset number where a Swing-High bar was found.  When a Swing-High bar is not found, function returns a -1.

 

The positive integer number represents the bar count back from the offset starting index of the swing bar.  Current bar is zero, and a return of 1, indicates one bar back.

 

Links:

SwingHigh, SwingLow, SwingLowBars

See Also:

Series Functions

 


Edit Time: 9/25/2017 09:09:58 AM


Topic ID#: 596

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software