Swing High Break Scan

I’m trying to run a scan that will show when a bar breaks of a previous swing high and then closes lower than the previous swing high. I have tried the following but when I run a scan it misses many. Below is my script.

//Define the GannSwing variable;
GS1 = GANNSWING(SWINGCOUNT=2, USEINSIDE=True, METHOD=Use Outside Bar, USECLUSTERS=False);

//Has the current swing up been confirmed?;
c1 = SWINGUP(GS1);

//Compare SwingStart values for previous swings;
c2 = HIGH() > SWINGSTART(GS1,1) and CLOSE() < SWINGSTART(GS1,1);
c3 = HIGH() > SWINGSTART(GS1,3) and CLOSE() < SWINGSTART(GS1,3);
c4 = HIGH() > SWINGSTART(GS1,5) and CLOSE() < SWINGSTART(GS1,5);
c5 = HIGH() > SWINGSTART(GS1,7) and CLOSE() < SWINGSTART(GS1,7);

//Signal when all conditions are true;

c1 and c2 or c3 or c4 or c5

Hi Liam,

The scan is looking for the current close being lower than the all the previous swing starts… to just show when the current high is higher than the previous swing but closes below try this:

 

GS1 = GANNSWING(SWINGCOUNT=2, METHOD=Use Next Bar, USEINSIDE=True);
C1 = SWINGUP(GS1);
C2 = HIGH() CrossesAbove SWINGSTART(GS1)[1];
C3 = CLOSE()<SWINGSTART(GS1)[1];
C1 and C2 and C3

Thanks Darren. Please see the attached screenshot where the scan is not picking up times when this has occurred. Any suggestions?

[attachment file=“55683”]

Hi,

The scanning manager will only show the first pass of the criteria (01-12-2009 in this instance) before it moves to the next code in the list, it won’t show all hits within the last 10 years.

If you want to see where all passes have occurred you will need to use the script with the Show Bar tool, this will add an arrow on each bar that passes the script.

If there are bars you find still not passing that you expect to see, i’d suggest splitting the script up into the 3 individual components (C1, C2 and C3) in Show Views below the chart, that way you can see which criteria isn’t passing on that date and work towards adjusting that criteria to suit the setup you’re after (example below).

Ex3

 

Many thanks Matthew, I wasnt aware it only showed one pass.