Filter false signals

Hi all,

I am new to MQL4, I am creating a simple indicator as most newbies would do - 2 MA cross signal


BUY - > When MA 20 cross MA 50 from below = arrow up

SELL - > When MA 20 cross MA 50 from top = arrow down

Indicator is almost done and is working, but i am getting quite a few multiple buy and sell signals when MA crosses frequently

How can i avoid getting false signals without incorporating any new oscillator​s i.e. RSI or ATR

Thanks for your help

Multiple time frame analysis is your friend.

One thought that comes to mind is to ensure the difference between MA(20) and MA(50) is greater than a threshold.

So, in pseudo code

const double THRESHOLD = 0.0001;

if ( MA(20) crosses MA(50) && MathAbs(MA(20)-MA(50)) > THRESHOLD )




the moving average changes as the price moves up and down

it is correct that the moving average can cross multiple times

you can either enter on the first cross and block the rest or based on other conditions.