I’m new to Optuma. As a learning exercise, I’m working to replicate the Gann swings script that Mathew Verdouw created in his “Gann Swings Part 2” video from 2017. By about the midpoint of the video the script Mathew’s built is as follows:
- g1 = GANNSWING(SWINGCOUNT=2, METHOD=Use Next Bar, USEINSIDE=True);
- g2 = GANNSWING(Week(),USEINSIDE=True, METHOD=Use Next Bar)
- e1 = SWINGEND(g1);
- c1 = HIGH() CrossesAbove e1[1];
- c2 = e1[2] < e1[1];
- c3 = (e1[5] > e1[3] )and (e1[3] > e1[1] );
- c5 = g2 IsUp;
- c4 = c1 and c2 and c3 and c5;
- NOREPEAT(c4, BARS=7)
The script works as expected for me up to the point where the functionality is added to allow the signal to trigger only when the weekly Gann swing IsUp (see code in lines 2 & 7 and the addition of “and c5” in line 8). When that additional code is added the signal stops triggering at all, even during periods when the weekly Gann swing is up as indicated by a Show View programmed as “GANNSWING(Week(),USEINSIDE=True, METHOD=Use Next Bar) IsUp”.
For example, I’ve verified this using a daily chart of MSFT with a Show View added to show periods when the weekly Gann swing is up, as noted just above. When line 2 is commented out of the Show Bar using “//” and “and c5” is removed from line 8, the signal is seen, for example, on January 31, 2022. The Show View confirms this date falls in a period during which the weekly Gann swing is up. However, when line 2 is uncommented back in and “and 5” added to line 8, the 1/31/22 signal disappears, even though that date is in a period in which the weekly Gann signal is up according to the Show View
.
Hopefully, I’ve explained this clearly enough. Can anyone tell me what might be the problem here and how to fix it?
Thanks very much,
Robert “Mick” McWilliams