Well we can write the code to do the job but you will find there is approximately 3-5 min time delay for watchlist updates. There is no point in trying to do the “rolling 5 min” and averaging. The value will be old, stale and useless. If this is mission critical I suggest you move to a more advanced platform.
So we just do a few lines of code that checks current close to previous close. Then you apply that to a 5 min column in a watchlist. The data will still be 3-5 minutes old. Nothing can be done to address that.
plot data = 100 * (close / close[1] - 1);
data.AssignValueColor(if data > 7.0 then Color.RED else Color.CURRENT);
AssignBackgroundColor(if data > 7.0 then Color.YELLOW else Color.CURRENT);
This second piece of code appends a percent sign to the end of the value. This allows applies a rounding function to reduce the value to one decimal place. If you want to add/remove decimals you will change the numeric value in this section of code: Round(data, 1).
def data = 100 * (close / close[1] - 1);
AddLabel(yes, Concat(Round(data, 1), "%"), if data > 7.0 then Color.RED else Color.CURRENT);
AssignBackgroundColor(if data > 7.0 then Color.YELLOW else Color.CURRENT);