Paradigm Trades_VPA Swing Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PierrePressure

//@version=4
study("VPA Swing Indicator", overlay=true)

// Determine if the current bar is a Volume Climax Up
vc_up = (volume > sma(volume, 20)) and (close > open)

// Determine if the current bar is a Volume Climax Down
vc_down = (volume > sma(volume, 20)) and (close < open)

// Plot signals
plotshape(vc_up, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, text="VCU")
plotshape(vc_down, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, text="VCD")

// Add alerts for the signals
alertcondition(vc_up, title="Volume Climax Up", message="A Volume Climax Up has formed")
alertcondition(vc_down, title="Volume Climax Down", message="A Volume Climax Down has formed")
