Looking for a sample expression to calculate a swing total volume.
I am using the following example code to return the sum of the values for the Volume taken over the swing period between the swing high and the swing low. Then the value is printed as Draw.Text over the Swing high:
double swingVolume = SUM(Volume, SwingHighBar - SwingLowBar)[CurrentBar - SwingHighBar]); where the period is the difference between swing high/low index bars
This approach works fine. however sometimes an error is generated that the "period" for "SUM" is a negative value.
Any idea or referring to a sample script to calculate the Swing total volume correctly is appreciated.
Thanks.
Comment