I have a script that sound like this:
//@version=5
indicator('XY Screener', shorttitle='XY Screener', overlay=false)
//EMA
ema1 = ta.ema(close,7)
ema2 = ta.ema(close, 14)
ema3 = ta.ema(close, 28)
ema4 = ta.ema(close, 60)
ema5 = ta.ema(close, 223)
f_triggerRvol(_ticker) =>
_x = request.security(_ticker, timeframe.period, (ta.crossover(ema1, ema3)))
_w = request.security(_ticker, timeframe.period, (ta.crossover(ema2, ema3)))
_y = request.security(_ticker, timeframe.period, (ta.crossover(ema3, ema4)))
_z = request.security(_ticker, timeframe.period, (ta.crossover(ema4, ema5)))
_msg = _ticker + ', ' + timeframe.period + ': '
if _x
_msg += 'LONG A'
alert(_msg, alert.freq_once_per_bar_close)
else if _w
_msg += 'LONG B'
alert(_msg, alert.freq_once_per_bar_close)
The system accept & save my script but when I update the script in a TV windows it says "cannot compile script". If I take away the three lines after the second condition (else if etc.) all goes well, the script is saved and updated on the TV window.
Someone could tell me why and, if is the case, how to solve this?
I would like that when a condition is met (_x or one of another I listed), the alert that I wrote for that condition'll work.