swing pattern script

I am predominantly interested in the gann swings, I have just signed up to start the free scripting courses you supply (thanks). I have attached a pattern that I ask for OPtuma asisstance for scripting it please as that way It will make it much easier for me to understand the swing relationship scripting language as I go through the course and then apply same in due course.

As per the below pattern GSW1 is greater than GSW3 and GSW3 is less than GSW5 and GSW2 is greater than or equal to GSW4 and then buy on break above GSW2, also GSW3 to be the lowest low of the last 20 bars.


Hi All ,

I think it is vary important gann swing pattern of first higher bottom after breaking previous top it is first indication of trend change from down to up in all time frame like weekly and monthly swing and in daily 1 bar,2 bar and 3 bar swing chart and same for down trend also

Hi Tim,

Did you see Mathew’s webinar on Gann Swing scripting? If not you can watch it here - hope you find it useful:


Here’s the script he used for the upswing taking out the previous high:

// get the swings
// get the ends of the swings
e1 = SWINGEND(g1);
// Calculate the up condition
(High() > e1[1]) and (e1[1] > e1[2])

Hi Darren, thanks for the reply but I am seeking your assitance for identification of swing ends. I have attached a picture of swing patternwhich is very similar to the one used in the video. NOw at the dotted line when it crosses swing end B, it effectively confirms swing end A as being a 'swing end'. So I am not sure when it references whether it references the swing A or is looking back. I am not chasing the formulae becasue I can work out various parts of that but so that I can be sure of what it is referencing, can you assist with referencing. So as in the picture I want to buy when high() crossesabove B and I want A to be a higher swing bottom than C, so as per the picture and using the identification of e1 = SWINGEND(g1); can you tell me what swing would be the equivalet references to the letters. In other words which letter would be g1, g1[1], g1[2] etc. I am assuming also that g1[2] for example is the same as gannswingend offset 2


thanksswing ends