This depends on how you compute the "percent change on the day".
- The built in column that displays percent change is based on the previous bar's close to the current price.
- Some might describe "percent change on the day" as the percent change from today's open to the current price.
Here is the code for the first scenario:
input percentThreshold = 30.0;
plot percentChange = if close[1] > 0 then 100 * (close / close[1] - 1) else 0;
percentChange.AssignValueColor(if percentChange > percentThreshold then Color.BLACK else Color.CURRENT);
AssignBackgroundColor(if percentChange > percentThreshold then Color.YELLOW else Color.CURRENT);
And here is the code for the second scenario:
input percentThreshold = 30.0;
plot percentChange = if open > 0 then 100 * (close / open - 1) else 0;
percentChange.AssignValueColor(if percentChange > percentThreshold then Color.BLACK else Color.CURRENT);
AssignBackgroundColor(if percentChange > percentThreshold then Color.YELLOW else Color.CURRENT);
Both of those are applied to a daily time frame to compute the values for the current trading day.
Screenshot below shows the result.