Reputation: 35
In pinescript is it possible to wrap a long if statement such that each condition is on a new line?
Example:
if condition_1 or condition_2 or condition_3
//do something
Desired format:
if condition_1 or
condition_2 or
condition_3
//do something
Upvotes: 1
Views: 2084
Reputation: 2171
Yes. If it wraps to the next line then the continuation of the statement must begin with one or several (different from multiple of 4) spaces.
For example with if
condition:
//@version=5
indicator("My script")
condition1 = barstate.islast
condition2 = true
if condition1 and
condition2 // one space only
label.new(bar_index, low, text="Hello, world!", style=label.style_circle)
Upvotes: 5