Download MetaTrader 5
To add comments, please log in or register
Having a great idea? Share it on the traders' Forum!
Paul
526
Paul 2015.08.26 12: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!

Keith Watford
Moderator
9597
Keith Watford 2015.08.26 12:28  

Then you have not coded what you have outlined above

Show your code and somebody may be able to help you 

/
To add comments, please log in or register