'"line 168: Syntax error at input 'end of line without line continuation'."
I'm trying to create a crypto trading strategy in TradingView, and everything was going well until my script decided to upgrade to v5. Everything works, but when I add these two lines, I get the above error.
There are no extra spaces, tabstops or anything else and I am very confused and irritated.
Lines:
strategy.entry(id="Enter Long", strategy.long, when=LongOpenConditions)
strategy.entry(id="Enter Short", strategy.short, when=ShortOpenConditions)
Solution 1:[1]
Okay, turns out "id=" wasn't supposed to be there. It threw the wrong error. Problem solved.
Solution 2:[2]
If you start using argument names in the function call, you must continue using other argument's names too after that point.
All below should compile fine.
strategy.entry(id="Enter Long", direction=strategy.long, when=LongOpenConditions)
strategy.entry("Enter Long", direction=strategy.long, when=LongOpenConditions)
strategy.entry("Enter Long", strategy.long, when=LongOpenConditions)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kr1msonReaper |
| Solution 2 | vitruvius |
