gain and loss over time formula

If I where looking at a particular security, say an ETN like the VXX and I wanted to see all the times it has gained or lost X% over Y # of days, how would I accomplish that?

You could see it in the Fundamental Chart.

Settings for the attached image are:
Return last 20 days > 10%
((close(0)-Close(20)) / close(20)) * 100 > 10
Smooth Line (or could use column)

Return last 20 days
((close(0)-Close(20)) / close(20)) * 100
Line