Inside Gann Swing

I am trying to write script for inside gann swing but its not working .
below is my script and attaching sample example some one please help me on fixing this.

// get the swingsg1 = GANNSWING(SWINGCOUNT=2, METHOD=Use Next Bar, USEINSIDE=False, USEBREAKOUT=False);// get the ends of the swingse1 = SWINGEND(g1(0));e2 = SWINGEND(g1(1));e3 = SWINGEND(g1(2));e4 = SWINGEND(g1(3));//get the swing startL1 = SWINGSTART(g1(0));L2 = SWINGSTART(g1(1));L3 = SWINGSTART(g1(2));L4 = SWINGSTART(g1(3));// show signalb1 = ((e3 > e2) and (e2 > e1 ) and (L3 < L2) and (L2 < L1)); b1

Capture4.jpg

see the below formulae, at the top is the parameters of what type of swing etc. Create a new indicator out of it, apply it in new tool. This one is the formulae for long trades only.

 

GS1 = GANNSWING(SWINGCOUNT=2, USEINSIDE=True, METHOD=Use Next Bar, USECLUSTERS=False);

c1 = SWINGUP(GS1);

c2 = SWINGSTART(GS1) < SWINGSTART(GS1, 1);

c3 = SWINGSTART(GS1, 1) < SWINGSTART(GS1, 3);

c4 = SWINGSTART(GS1) > SWINGSTART(GS1, 2);

c5 = SWINGSTART(GS1, 2) > SWINGSTART(GS1, 4);

s1 = SWINGEND(GS1[1]);

U1 = SWINGUP(GS1);

V1 = IF(S1 < SWINGEND(GS1[2]),SWINGEND(GS1[2]),S1);

c7 = high() CrossesAbove V1 and U1 == 1;

c1 and c2 and c3 and c4 and c5 and c6

Thanks Tim,

I tried creating custom tool and show bar options both are not working.

its not showing any script error but its not plotting any signals . I did ran scan for 5 years data not even one signal on it.

may be am I missing something?

My apologies I altered a couple of things and forgot to fully fix up, see below, naturally you can alter the GS1 swing parameters to suit. It shows the completed triangle, but there are as always some anomolies. There are different scripts if your looking for triangles forming but not yet confirmed, I have pasted also below a script that finds patterns where the swing turns up to create the possible triangle but may not yet have closed above the swing top to confirm a triangle, It would be more a script to use in scanning looking for potential triangle candidates

 

GS1 = GANNSWING(SWINGCOUNT=2, USEINSIDE=True, METHOD=Use Next Bar, USECLUSTERS=False);

c1 = SWINGUP(GS1);

c2 = SWINGSTART(GS1) < SWINGSTART(GS1, 1);

c3 = SWINGSTART(GS1, 1) < SWINGSTART(GS1, 3);

c4 = SWINGSTART(GS1) > SWINGSTART(GS1, 2);

c5 = SWINGSTART(GS1, 2) > SWINGSTART(GS1, 4);

s1 = SWINGEND(GS1[1]);

U1 = SWINGUP(GS1);

V1 = IF(S1 < SWINGEND(GS1[2]),SWINGEND(GS1[2]),S1);

c6 = high() CrossesAbove V1 and U1 == 1;

c1 and c2 and c3 and c4 and c5 and c6

 

 

//Gann swing triangle canditates//

GS1 = GANNSWING();

SWINGUP(GS1) and (SWINGSTART(GS1) > SWINGSTART(GS1, 2))

and (SWINGSTART(GS1, 2) > SWINGSTART(GS1, 4))

and (SWINGSTART(GS1, 1) < SWINGSTART(GS1, 3))

thanks Tim its working..

Do you mind sharing a video or screen shot on how we can apply this to our charts... pleease :)

I am not expert trader I am still learning.

you can see in attached screen shot, if price cross signal bar it is buy for me based on that I will place the order.

 

This sounds very similar to the olivers wedge pattern already built into optuma through purchase.

How does this differ?

I am not sure and if it is already available then it is good to know and I am sure it may have more functionality's.