tôi cần sửa lỗi của đoạn code sau: Cannot call 'CheckOrders' with argument…
- User
tôi cần sửa lỗi của đoạn code sau: Cannot call 'CheckOrders' with argument '_ticker'='ticker'. An argument of 'series string' type was used but a 'simple string' is expected. The function 'CheckOrders' should be called on each calculation for consistency. It is recommended to extract the call from this scope. đoạn code: // List of tickers tickers = array.new_string(19) array.set(tickers, 0, "BINANCE:BTCUSDT.P") array.set(tickers, 1, "BINANCE:ETHUSDT.P") array.set(tickers, 2, "BINANCE:BNBUSDT.P") array.set(tickers, 3, "BINANCE:SOLUSDT.P") array.set(tickers, 4, "BINANCE:ENSUSDT.P") array.set(tickers, 5, "BINANCE:AVAXUSDT.P") array.set(tickers, 6, "BINANCE:LINKUSDT.P") array.set(tickers, 7, "BINANCE:TONUSDT.P") array.set(tickers, 8, "BINANCE:TIAUSDT.P") array.set(tickers, 9, "BINANCE:RNDUSDT.P") array.set(tickers, 10, "BINANCE:DOTUSDT.P") array.set(tickers, 11, "BINANCE:NEARUSDT.P") array.set(tickers, 12, "BINANCE:WLDUSDT.P") array.set(tickers, 13, "BINANCE:WIFUSDT.P") array.set(tickers, 14, "BINANCE:OPUSDT.P") array.set(tickers, 15, "BINANCE:DOGEUSDT.P") array.set(tickers, 16, "BINANCE:NOTUSDT.P") array.set(tickers, 17, "BINANCE:XRPUSDT.P") array.set(tickers, 18, "BINANCE:MATICUSDT.P")
// Loop through tickers and check orders and exits for i = 0 to array.size(tickers) - 1 ticker = array.get(tickers, i) [Long_order_sec, Short_order_sec, long_exit_sec, short_exit_sec] = CheckOrders(ticker)
codeif Long_order_sec strategy.entry("Long " + ticker, strategy.long) long_entry_price := close long_trade_bars := bar_index if Short_order_sec strategy.entry("Short " + ticker, strategy.short) short_entry_price := close short_trade_bars := bar_index if long_exit_sec strategy.close("Long " + ticker) if short_exit_sec strategy.close("Short " + ticker) Assistant
The error message you're encountering indicates that the function
CheckOrdersexpects a simple string (a single string value) but is being passed a series string (a string that changes over time, typically derived from an array or a variable that updates over bars).
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.