简体   繁体   中英

TradingView - Incorrect for statement, Expecting to expression

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:

  1. You can get the data from the other tickers, but you can't execute the script itself on those other tickers.
  2. There is a limit of 40 calls per script.

If you're looking to use the TradingView data for some kind of a screener, consider the above limitations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM