Slope Indicator not giving accurate values

 
I put the attached indicator on a chart and it is giving positive values when the MA slope is negative. Any help would be appreciated
Files:
Ma_Slope.mq4  3 kb
 
JohnEscott it is giving positive values when the MA slope is negative.
  1. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. Nothing apparent in the code, post a screen shot of your chart with the SMA(n,Close) on it.