ESPL: Sum Volume for a Swing

Q:  How can I determine the volume for a swing, or the volume between two bars on the chart?

A:  I will illustrate 3 ways in my answer.  The first way is to use the Pesavento Patterns study and change the Marker to the VOL selection, which will sum the volume for a swing.  This tool is automatic in picking the swing points.

The 2nd suggestion is to put on a Draw Line with the same VOL marker and the total volume in the bars spanned by the draw line will be printed at the end of the line.  See an example of the draw line’s volume in the next image.

The 3rd suggestion is to use the ESPL programming language, and sum the volume in a loop between two index locations on the chart.  The example will use two index points from the Pesavento Patterns study.  Any two index points could be used.

Line 12 finds the chart.  Line 13 finds the Pesavento Patterns study.  Lines 14 and 15 find the two indexes for the prior swing.   Line 16 writes the total volume to the output window.

The total volume is summed by the Function SumVolume which loops through the bars between the two indexes passed as parameters and adds each bar’s volume to the total.