You are probably overthinking this solution. You build this using the daily time frame and then add a condition that checks of the close of the current bar is greater than the close of the previous bar (using the offset parameter on the right side of the condition).
Screenshot below shows how to set this up.
Some comments on the code you provided in the comment below your question.
- Within the Thinkorswim language, the current price is always going to be the "close". Not the Mark, the bid, the ask or any other price type. Trust me on this. I have irrefutable evidence this is true. For some reason many users of Thinkorswim are mislead into thinking they have to do some other "trick" to persuade the scan to get the current price. Just use the close. Yes, the close gives you real time price changes real time results.
- Within a Study Filter on Thinkorswim only one time frame is permitted. There is no way to reference a secondary aggregation period within the Study Filter of a scan on Thinkorswim. So when you use "close(period = "DAY")" on a Study Filter it does not work.
All you have requested is to check of today's current price is greater than or less than yesterday's close. You just set the Study Filter to Daily time frame and compare the close of the current bar to the close of the previous bar.
Yes, if today's candle changes from red to green this scan will pick that up intraday and in real time. Even though the Study Filter is set to Daily time frame.
Sorry, I know a lot of viewers will be running across this post for years to come and I just wanted to try to answer all of the most common questions that are going to show up in the comments section if I don't provide those answers.