Gann Swing Volume

I am trying to create a script that will show the cumulative volume on a Gann Swing chart. It is very similar to the Weiss Wave Volume but based on the Gann Swing tops and bottoms.

I have spent the better part of 2 days to get the following script to work but with no success. The Char is always a “zero” value. It is a script that Trevor posted a few years ago that appears to do exactly what I want. I assume that Optuma changed and the script no longer works based on script functionality changes. If anyone can help I would appreciate it. Also, any suggestions on how I can learn this script language better? I have taken the online classes and they make sense. I can create simple scripts but I would love to have a manual or something to explain the more advance functions. Any help would be wonderful.

// Volume Between Gann Swings

GS =GANNSWING(DEFAULT=SwingList, USECLUSTERS=False, USEBREAKOUT=False, SWINGCOUNT=2);

GSStart= SWINGSTART(GS);

GSEnd = SWINGEND(GS);

Rng = GSStart-GSEnd;

// Down Swings bars

Sig1 = if((TIMESINCESIGNAL(GSStart) > 0 and Rng > 0) , 1, 0);

Sig2 = IF(TIMESINCESIGNAL(GSEnd) < 1 and Rng < 0, 1, 0) ;

Sig3= If(Sig1 or Sig2, 1, 0);

// Up Swing Bars

Sig4 = if((TIMESINCESIGNAL(GSStart) > 0 and Rng < 0), 1, 0);

Sig5= IF(TIMESINCESIGNAL(GSEnd) < 1 and Rng > 0, 1, 0) ;

Sig6= If(Sig4 or Sig5, 1, 0);

// Plot the Down trend Volume

Plot1 = If(Sig3, ACCSINCESIGNAL(Vol(), Sig1), 0) ;

Plot1.Colour = Red;

Plot1.Plotstyle = Histogram;

Plot1.LineWidth = 5;

Plot1.LineStyle = Solid;

// Plot the Down trend Volume

Plot2 = If(Sig6, ACCSINCESIGNAL(Vol(), Sig4), 0) ;

Plot2.Colour = Green;

Plot2.Plotstyle = Histogram;

Plot2.LineWidth = 5;

Plot2.LineStyle = Solid;

 

Gannn-Swing-Volume.docx (14.6 KB)

Hi,

Please check out the following thread, this should assist in building the script you are after:

https://forum.optuma.com/topic/variant-of-weis-wave/#post-49999

Hi Matthew,

At Ticket #49999 (2 Dec 2018) I posted the above code, which worked as can be seen from the chart accompanying it.

Now it doesn’t☹

I’m darned if I can work out why it no longer works, even when I open the original Workbook in which the script was originally written and the chart created.

Any clues as to what has changed in the intervening period?

Thanks for any clues.

Trevor

Hi Matthew,

Following on from Ticket #69847 above, in trying to resolve the issue with the original script for calculating the volume from one Gann Swing to the next I’ve created the following script:

// Volume Between Gann Swings 
// Set Swing Bars 
#$SwingBars=2; 
// Set Gann Swing Properties 
GS = GANNSWING(DEFAULT=SwingList, SWINGCOUNT=$SwingBars, USEINSIDE=False, USECLUSTERS=False, USEBREAKOUT=False, METHOD=Use Next Bar); 
// Determine Swing Starts and Ends 
GSStart= SWINGSTART(GS); // Value of swing hi/lo 
GSEnd = SWINGEND(GS); // Value of swing hi/lo
// Swing Signals 
Sig1 = SIGNALAFTER(GSStart[1], NUMBER=1, INCSAMEBAR=True); 
Sig2 = SIGNALAFTER(GSStart, NUMBER=1, INCSAMEBAR=True); 
// Plot the Volume 
Plot1 = IF(TIMESINCESIGNAL(Sig1) > 0, ACCSINCESIGNAL(vol(0) , Sig2) , 0); 
Plot1.Colour = Red; 
Plot1.Plotstyle = Histogram; 
Plot1.LineWidth = 5; 
Plot1.LineStyle = Solid;

This provides to following chart with the accumulated volume plot betwen the Gann Swing Tops and Bottoms, but the volume at each Top/Bottom swing is not shown as included in the accumulation (see 5 Jul 22 and 18 Jul 22):

However, exporting the volume data from Optuma and summarising the accumulated volume caculations in Excel reveals the following:
20221128 Volume Calculations
The desired volume calculation is that shown in column “ACC(Volume)”, ie the first included volume should be that from the bar following the swing bottom bar and the last to be included should be the volume from the swing top bar. However, the final bar in the preceding down swing is being used as the starting volume for the up swing, and the final bar in the up swing (the swing top bar) in not included.

Two questions:
1 How to achieve the desired calculation, and
2 How to have the desired calculation reflected in the plot?

Cheers
Trevor
The Auld Tyma from
Auld Tyma Data Logo with URL 1 cm

20221128-Volume-between-Gann-Swings.owb (30.9 KB)

Hi,

A number of script functions have had adjustments since the original code was written. The following adjusted version should work:

GS = GANNSWING(SWINGCOUNT=2, USECLUSTERS=False, USEBREAKOUT=False);
GSStart = SWINGSTART(GS);
GSEnd = SWINGEND(GS);
Rng = GSStart-GSEnd;
GSHL = If (GSStart < GSEnd, High(), Low());
SwingBottom = GSHL ChangeTo HIGH();
SwingTop = GSHL ChangeTo Low();
//GSHL ChangeTo HIGH() or GSHL ChangeTo Low()
// Down Swings bars
Sig1 = if((TIMESINCESIGNAL(SwingBottom ) > 0 and Rng > 0) , 1, 0);
Sig2 = IF(TIMESINCESIGNAL(SwingTop) < 1 and Rng < 0, 1, 0) ;
Sig3= If(Sig1 or Sig2, 1, 0);
// Up Swing Bars
Sig4 = if((TIMESINCESIGNAL(SwingTop) > 0 and Rng < 0), 1, 0);
Sig5= IF(TIMESINCESIGNAL(SwingBottom) < 1 and Rng > 0, 1, 0) ;
Sig6= If(Sig4 or Sig5, 1, 0);
// Plot the Down trend Volume
Plot1 = If(Sig3, ACCSINCESIGNAL(Vol(), Sig1), 0) ;
Plot1.Colour = Red;
Plot1.Plotstyle = Histogram;
Plot1.LineWidth = 5;
Plot1.LineStyle = Solid;
// Plot the Down trend Volume
Plot2 = If(Sig6, ACCSINCESIGNAL(Vol(), Sig4), 0) ;
Plot2.Colour = Green;
Plot2.Plotstyle = Histogram;
Plot2.LineWidth = 5;
Plot2.LineStyle = Solid;

Ex6

Brilliant thanks Matthew.

Cheers

Trevor