1

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

1 Answers1

4

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.

Here are some examples

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)
mr_statler
  • 1,913
  • 2
  • 3
  • 14