As to part one of your question. There is no way (at this time) to get user input fields to populate when creating custom Study Filters for the scans in Thinkorswim.
The second part of your question. The code contains a user input for ATRPeriod. However this input is never used in the subsequent lines of code. But that is not the problem. I would offer a solution however I really don't understand what your goal is. "Scan for last bar above ATR....". ATR is computed using the high, close and low of each candle over a given length. And you are trying to compare that to the range of the body of the candle (close - open). To me, that is comparing apples to oranges.
Seems to me that you would want to compare the ATR of the current bar to the ATR averaged over a given length. So perhaps you would compute the ATR with a length of 14. Then compute the ATR with a length of 1. The later is the ATR value of the current bar. But I'm really not sure that is what you intended. So I don't have a solution for you.
After receiving feedback from the author of this post I have the following update for this response:
input atrPeriod = 14;
input percentage = 20.0;
plot scan = ATR(1) > ATR(atrPeriod) * (1 + (percentage * 0.01));