Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line wrapping for a long set of function values in Pine Script

Tags:

pine-script

I'm trying to wrap this line, as it is too long to see all on one screen:

strategy.entry
    ("Long Continuation", 
    true, 1, when = FastMA < SlowMA and SlowMA > SlowMA[5] and ShortDiff < 
    ShortDiff[1]
    and close[1] < _PercentAbove and close[1] > _PercentBelow)

It works unwrapped, but when I wrap it, I get the error, "Add to Chart operation failed, reason: line 15: syntax error at input 'end of line without line continuation'

I realize I can shorten this with better code, but I'm just curious about line wrapping works in Pineenter code here

like image 829
sunspore Avatar asked Oct 31 '25 13:10

sunspore


1 Answers

If you want to wrap lines, next line must begin with one or several (different from multiple of 4) spaces.

Your code seems to have 4 spaces, which causes the error.

The following code should compile.

strategy.entry("Long Continuation", 
 true, 1, 
  when = FastMA < SlowMA and SlowMA > SlowMA[5] and
   ShortDiff < ShortDiff[1] and close[1] < _PercentAbove and
     close[1] > _PercentBelow)

It has 0, 1, 2, 3, 5 spaces, respectively.

like image 157
vitruvius Avatar answered Nov 02 '25 12:11

vitruvius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!