0

I am using iMACD(NULL, PERIOD_CURRENT, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, i) function to get an MACD value but it returns fraction number, like 0.154154 or -0.154549, so I need to check if the MACD value is positive or negative.

How do I check that?

user3666197
  • 1
  • 6
  • 50
  • 92

1 Answers1

0

Q : How to check if MACD value is Negative or Positive?

Using the returned value, just test it like this:

if ( 0 > iMACD( _Symbol, PERIOD_CURRENT, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, i )
{ // NEGATIVE
     ...
  }
else
{ // NON-NEGATIVE
     ...
  }
user3666197
  • 1
  • 6
  • 50
  • 92