gann weekly swing trend query

gs1 = gannswing(week());


The above formula i use to show when the weekly 1 bar swing is trending up and is typically overlaid on a daily chart. So as an indicator in my scripts I use it with ‘use as an indicator’ and ‘new tool view’, however it does not appear to register the swings correctly. If I use monthly instead of week then it works, but for some reason I can’t get the weekly one to work. Can anybody suggest why its not working


Hi Guys,

I can find no reference to SWINGTRENDUP or SWINGTRENDOWN in the Knowledge Base Formula Functions & General Interface article even though the functions seem to work, but not as expected☹

A Weekly Gann Swing overlay (cyan) on a Daily chart with Tim’s “Weekly” script (green) as a plot:

20200206 Tim's Script, Ticket 56911

I would have to agree the result is not what I’d have expected☹

Are these Swing functions described somewhere else? Hopefully any such description will include the criteria that define when the swing trend is up.



Thanks Trev, Swing trend up is for ganns rules whereby so long as the market was making higher swing lows then the trend was up and of course trend is down when that swing low is broken and so forth. If you use monthly instead of week you will see that it works but for some reason not when using the weekly term. ‘swingtrendup’ is an option when doing functions.

The only problem when using swingtrendup/down function is that it won’t show trend change until the end of time period, so for example if on a monthly swing chart the previous trend being down suddenly breaks above the most recent swing high mid month to cause a swing trend change on a monthly basis, it will not actually show that trend change until the end of month. I should also add that if you use the same function but use number of bars on the daily chart then it also works.

Ahh, looks like I forgot to add those to the KB.

Change the colour scheme of your Gann Swings to “Trend” and you will see what this tool is capturing. Gann put forward the idea that the trend is up not when the swing turned up but when a previous high was taken out. It stayed in an up trend until a previous low was taken out.

If you want the SwingUp(), use that function or do gs1.IsUp

All the best