newbie needs some help with conditional if

 

Hi hoping someone might advise me what I am doing wrong here

i have a indicator that works well with a standard condition like:

if x(i) > x(i+1) UpBuffer[i] =1; else if x(i)<x(i+1) DownBuffer[i]=-1, else ZeroBuffer[i]=0.5

however I want to add additionaol conditions like the following (yet despite reading the documentation on the conditional operators, I can't get it to work):

((if x(i) > x(i+1) AND x>-1) and( x(i) <x(i+1) and x>1)) UpBuffer[i]=1 etc

Any help would be appreciated:

My attempt to write it was in the following format but I only got a plot for my UpBuffer and not sure how to fix.

if((x(i)>x(i+1) && x(i)>-1)||(x(i)<x(i+1) && x(i)<1))

UpBuffer[i]=1;

else if ((x(i)>x(i+1) && x(i)<-1)||(x(i)<x(i+1) && x>1))
DownBuffer[i]=-1;

else ZeroBuffer[i]=0.5;

Thanks in advance

Dave