GANNSWING() Function

Author: Optuma Team Last updated: Jun 15, 2021 10:26


Gann Swing charts include a scripting function: GANNSWING()

GannSwing Function 1

Dot Notations

The GANNSWING() function supports dot notations, allowing different aspects of the swing to be referenced.


From Optuma 2.0 and later support has been added for Swing Trend Up and Swing Trend Down notations, which produce a Boolean result.



Tool Name: Allows you to adjust the name of the tool, as it’s displayed in the Structure Panel.

Default Plot: Allows you to set which part of the swing is being used within the script. The 3 options are Swing List (the full swing), Swing Start and Swing End

Swing Count: Sets how many time periods (bars) must take place in the same direction for the swing to turn. For example, if set to three there would need to be three successive higher bars before a down swing would turn up.

Outside Bar Calc: Sets how outside bars are treated in the swing calculation. Click the drop down arrow to select the Use Outside Bar or Use Next Bar option.

Use Inside: Sets whether inside bars are considered in a bar count of Gann Swings.

Cluster Outside and Inside Bars: Lets you set which rules are used when handling clusters of inside and outside bars.

Use Breakout: This option can only be used with a swing count greater than one. If the turning point of the previous swing is exceeded before the number of bars in the swing count has occurred this is called a ‘breakout’ and the new swing will be drawn.

Example Scripts

Find where the Gann Swing is higher than the previous day (after Swing Confirmation):


GannSwing Function 3

Find the Turning Point for the Gann Swing moving from Up to Down Swing (Swing Confirmation Point)


GannSwing Function 4

Look for an upswing and the swing high is lower than the previous swing high


GannSwing Function 5

Weekly Swing on Daily Chart

Gann Swings are able to handle time frames different to those they are placed on. For example:


If the above script is applied to a daily chart, the Weekly Gann Swing will be drawn on over the daily time frame.

GannSwing Function 6