Question about positive and negative numbers

 

I've been trying to establish the cross above or below zero, on an indicator. I am comparing the value of Bar #2 to Bar #1. Not Bar #0. If Bar#2 0 then cross up. If Bar#2 > 0 and Bar#1 < 0 then cross down. Should be simple. If below 0, number is negative. If above, positive. My problem is, that when both Bars are negative, the code ignores their state and which ever Bar is larger determines cross up and cross down. Same condition occurs with both Bars, positive. How would I code this so that I only consider one Bar positive and one Bar negative to determine cross up or cross down, and ignore cases where there is two Bars positive or two Bars negative?

Thanks!

 

If you are comparing the way you described, then the cases when they have same sign are implicitly already excluded. Something else is then wrong in your code

Reason: