Home > Software engineering >  Pine Script How To IF-THEN-AND
Pine Script How To IF-THEN-AND

Time:05-04

I have a statement (if x then do y). How can I add a second action (if x then do y AND z)?

count = 0
if (x)
    do y AND count  = 1

Also, would you specify the type for count, and what is pine script's equivalent of = ? Is there a place to play around with code, like a sandbox/console (similar to JavaScript).

CodePudding user response:

All actions in the if block will get excuted:

count = 0
if (x)
    do y 
    count  = 1

Also, would you specify the type for count

You don't have to, unless it's na. All of the following is correct:

int count = 0
count = 0

int count = na
count = int(na)

what is pine script's equivalent of =

= in pine script is the same as in other languages.

Is there a place to play around with code, like a sandbox/console (similar to JavaScript)

There is no console in pine script. Read this to get help with debuging.

  • Related