Help needed with conditional IF when building an indicator

 

Hello, I have been using an indicator that works great and involves the plot of a histogram (green bar when indicator value of bar i exceedes that of bar i+1, red bar when indicator value of bar i is less than that of bar i+1, yellow histogram for uncertain area.

As I say the indicator works great, but when I try to add a second condition, I am only getting a plot for my long positions.

I have almost know coding experience and have been working on substitution and guidance in the documentation section of this forum.

In my modified indicator, I want the Long or UpBuffer condition to be satisfied if either of 2 scenarios are satisfied, but each scenario having 2 internal conditions, the DownBuffer to be satisfied if either of 2 scenarios are satisfied, but each scenario having 2 internal conditions, and the ZeroBuffer to be satisfied for any remaining conditions.

I have tried to express this as following, hoping you might point out what I am doing wrong (in terms of coding)

thanks dave

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

UpBuffer[i]=1;

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

else ZeroBuffer[i]=0.5;
 

It looks good to me, although I expect that this is not a direct copy of the code, but a copy of the pseudo code.

Perhaps (using the SRC formatting button) paste your actual code. Maybe the real code doesn't exactly represent the pseudo code (says he who has made many such mistakes)