'Syntax: ternary operator within if condition block
Please help this noob with basic syntax!
I'd like to have macd_buy as my 5th condition if useMACD flag is true. I thought this syntax worked but id doesn't. Which is the most elegant way to add a few "and..." conditions that are flag-dependant? Thank you!
useMACD = input.bool(false, title="use MACD")
macd_buy = hist<0 and hist[1] < hist
enterLong() =>
if close < lower
ta.crossover(fish1,fish2)
and [my 2nd condition]
and [my 3rd condition]
and [my 4th condition]
and useMACD ? macd_buy : na // <---- this doesn't work
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
