Code Library / RSI Strategies

MQL4 RSI with MA Filter

RSI trading filtered by moving average trend direction.

Language: MQL4 · Category: RSI Strategies · Tags: RSI, moving average, filter, MQL4, trend

Source code

int CheckSignal() {
   double rsi0=iRSI(Symbol(),0,14,PRICE_CLOSE,0);
   double rsi1=iRSI(Symbol(),0,14,PRICE_CLOSE,1);
   double ma=iMA(Symbol(),0,200,0,MODE_SMA,PRICE_CLOSE,0);
   if(rsi1<30&&rsi0>=30&&Close[0]>ma) return 1;
   if(rsi1>70&&rsi0<=70&&Close[0]<ma) return -1;
   return 0;
}

How to use this snippet

This is a building block, not a finished trading system. Paste it into your own MQL4 project, compile it, and test it on a demo account with your broker's real spreads before relying on it. If MetaEditor reports errors, the compilation error fixer can help.

Related snippets