Question about positive and negative numbers

Back to topics list To post a new topic, please log in or register
avatar
186
Yellowbeard 2015.08.26 14:10
 

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 and Bar#1 > 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!

avatar
Moderator
3404
GumRai 2015.08.26 14:28 #
 

Then you have not coded what you have outlined above

Show your code and somebody may be able to help you 

Back to topics list  

To add comments, please log in or register