On the attached WorkSheet the Show Bar Scripts do not always work as intended. I partly fixed the problem by using

c1 = HIGH(OFFSET=1) < e1[1] and HIGH() > e1[1];
instead of

c1 = High() CrossesAbove e1[1];
The intendent of the Show Bar script is to identify a Higher Gann Swing High after a Higher Gann Swing Low.

g1 = GANNSWING(SWINGCOUNT=1, METHOD=Use Next Bar, USEINSIDE=True, USECLUSTERS=True, USEBREAKOUT=True);
e1 = SWINGEND(g1);
c1 = High() CrossesAbove e1[1];
//c1 = HIGH(OFFSET=1) < e1[1] and HIGH() > e1[1];
c2 = e1[2] < e1[1];
c3 = e1[2] < e1[0];
c4 = c1 and c2 and c3;
c4
Help would be appreciated.

Cheers, Lester

GS-Not-Working-as-Expected.owb (14.8 KB)

I don’t know for sure but maybe it is this line:
c4 = c1 and c2 and c3
I would have thought that it should be;
c4=c1 and c4=c2 and c4=c3
and then I would leave out the last line, “c4”
It’s only a guess. I have not researched that coding grammar.

cheers
Michael

Hi Michael,
Thank you for your contribution, however unfortunately it does not work. It also gives a script error.

I believe the statement line first assigns the value of c1 to c4 and then the value of c2 to c4 then the value of c3 to c4. After this the script engine looks for c4 (since it has been assigned a value). It then gives an error because there is none.

c4=c1 and c4=c2 and c4=c3
Regards, Lester

OPMV2012
(Mathew Verdouw, CMT, CFTe)
29 March 2021 15:44
4
Hi Lester,

The issue here is mixing Bar Lists and Swing Lists.
For more information, look at this post https://www.optuma.com/swing-scripting-1/

So you can introduce e2 which is the bar-by-bar swing end value. But note that every higher bar is going to trigger that. See Lines 5&6.

//Gann Swing Trend Up U1
g1 = GANNSWING(SWINGCOUNT=1, METHOD=Use Next Bar, USEINSIDE=True, USECLUSTERS=True, USEBREAKOUT=True);
e1 = SWINGEND(g1);
e2 = g1.SwingEnd;
c1 = High() CrossesAbove e2[1];
//c1 = HIGH(OFFSET=1) < e1[1] and HIGH() > e1[1];
c2 = e1[2] < e1[1];
c3 = e1[2] < e1[0]; //c3 = (e1[5] > e1[3]) and (e1[3] > e1[1]);
c4 = c1 and c2 and c3;
c4
//norepeat(c4)
Another way is to change the CrossesAbove to be the Swings. See Line 6

//Gann Swing Trend Up U1
g1 = GANNSWING(SWINGCOUNT=1, METHOD=Use Next Bar, USEINSIDE=True, USECLUSTERS=True, USEBREAKOUT=True);
e1 = SWINGEND(g1);
e2 = g1.SwingEnd;
c1 = e2 CrossesAbove e1[1];
//c1 = HIGH(OFFSET=1) < e1[1] and HIGH() > e1[1];
c2 = e1[2] < e1[1];
c3 = e1[2] < e1[0]; //c3 = (e1[5] > e1[3]) and (e1[3] > e1[1]);
c4 = c1 and c2 and c3;
c4
//norepeat(c4)
In your workbook, where you say “Neither function worked here” that is because your other rules. I think your offsets are wrong. Have a look at this post for a tip on numbering swings. https://forum.optuma.com/topic/identifying-gaps-on-gann-swing-charts/

All the best

Mathew

Hi Mathew,
Thank you very much for your very detailed answer. I hope there is nothing else in Optuma as tricky as Gann Swings!

Regards, Lester