I don't understand the request. The ticker symbol loaded on the chart is already displayed on the chart. You do not need a chart label to display the currently loaded ticker symbol on the chart.
Now, I'll take some time to explain why your code is not working. The following statement is invalid:
def x = if ticker then "/ES" else GetSymbol();
Variable declarations in Thinkorswim must ALWAYS be in the form of a numerical value. String values are not permitted. So you cannot assign the ticker symbol to a variable, period.
Your code implies that you want to display a ticker symbol other than what is currently loaded on the chart. Otherwise, why would you include a user input for the ticker and set its default value to "/ES". However that doesn't make sense so instead I will provide a signal line of code that will place a label on the chart to display the ticker symbol that is currently loaded on the chart.
AddLabel(yes, Concat("Ticker: ", GetSymbol()), Color.WHITE);
However when you apply this to a chart of /ES the label displays it as "/ES:XCME". Which is exactly what you said you were trying to avoid. Now we are back at the very beginning of the thought process. Which is that you are trying to do something that is already displayed on the chart. See screenshot below for an example of what I can talking about.