Skip to content

Instantly share code, notes, and snippets.

@joepegler
Last active May 18, 2018 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joepegler/7b6242d9637a0c1d7e3a6ed0a8d222c7 to your computer and use it in GitHub Desktop.
Save joepegler/7b6242d9637a0c1d7e3a6ed0a8d222c7 to your computer and use it in GitHub Desktop.
//@version=3
study("Pump Catcher")
length = input(title="Lookback Period (in candles)", type=integer, defval=20)
abnormalVolumeThreshold = input(title="Abnormal Volume threshold (1-99)", type=integer, defval=50, minval = 1, maxval = 99)
mav = sma(volume, length) // Average volume of the last 20 candles.
difference = mav - mav[1] // Difference between the last candles volume and this one.
volumeIncreasing = difference > 0 // Is the volume increasing?
valueIncreasing = close > close[1] // Is the value increasing?
increasing = valueIncreasing and volumeIncreasing
vroc = increasing ? difference * (100 / mav[1]) : 0 // If it's increasing then set the rate, otherwise set it to 0.
// To normalise the data express the current rate of change as a % of the maximum rate of change the asset has ever had.
historicMax = 0.0
firstVrocNormalizedValue = 40 // Because ICO coins generally kick off trading with a lot of volatility
historicMax := vroc > historicMax[1] ? vroc : nz(historicMax[1], firstVrocNormalizedValue)
vrocNormalized = vroc / historicMax * 100
plot(vrocNormalized, color=#F2F2F2, linewidth=1)
fill(hline(abnormalVolumeThreshold), hline(abnormalVolumeThreshold))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment