I am trying to create a loop to print all Kukoin exchenge pairs.
But an error is displayed. How can I fix this problem?
Incorrect for statement, Expecting to expression
//@version=5
study("EMA 89 EMA 200 Kucoin Alerts")
exchange = input("Kucoin")
symbols = syminfo.ticker
for i = 1 to #symbols
symbol = symbols[i]
security(exchange,symbol,60)
ema89 = ema(close, 89)
ema200 = ema(close, 200)
Pine script doesn't work like that.
In pine script, you can execute a script on a specific chart which has only one ticker. You cannot execute the script on multiple tickers at a time, and you can't execute a script on all tickers of one exchange (since it is still more then one ticker).
You can, if you want, receive data from other tickers to you current ticker using the request.security()
function (which on older versions of pine script was just security()
) but keep in mind you have some limits, most noticeable:
If you're looking to use the TradingView data for some kind of a screener, consider the above limitations.