Well there are two reasons. One is the use of “GetSymbolPart(1)”. That method is used for compound symbols. Something like a “pairs chart” where you subject one symbol’s values from another (IBM-AAPL).
But for some reason “GetSymbol” does not work either. I am not sure why by you should take that up with thinkscript support.
I can give you a workaround. Be careful when using this because if that futures symbol ever ceases to exist your code will fail and require modification.
def X = if close("/ES") > 0 then 2700 else if getSymbol() == “SPY” then 270 else Double.NaN;