-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor -
No question asked. You said what you don't want. Didn't say what you do.
-
You check MA[1] vs MA[0]. The EMA always moves in the direction of the Close.
-
int FastMaMethod = 1; int FastMaAppliedTo = 0;
Don't hard code constants. Use the proper enumerations and make your code self-documenting: ENUM_MA_METHOD and ENUM_APPLIED_PRICE
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I want help on configured EA which works on RSI 12 period (30-70) with cross over 200 EMA.
From the above pic RSI period 12 (30-70) is giving confirmation and also 200 EMA is giving confimration so, this EA took trade exactly at the the border of 200 EMA.
That i dont want. I want this to execute it atleast 2 or 3 candles below or above from 200 EMA not on the candle which is crossing the same 200 EMA .
Code for RSI and EMA that i am using is :
***************************Declared Variable *******************************
int FastMa = 200;
int FastMaShift = 0;
int FastMaMethod = 1;
int FastMaAppliedTo = 0;
int rsi_period=12;
int rsi_shift=0;
*******************************************************Cross Over 200 EMA**************************************************************
double CurrentFast =iMA(Symbol(),0,FastMa,FastMaShift,FastMaMethod,FastMaAppliedTo,0);
double CurrentSlow =iMA(Symbol(),0,FastMa,FastMaShift,FastMaMethod,FastMaAppliedTo,1);
******************************************************************RSI***********************************************************************
double rsi=iRSI(Symbol(),0,rsi_period,PRICE_CLOSE,rsi_shift);
************************************************************Sell & Buy Signal************************************************************************
if ((CurrentFast > CurrentSlow) && rsi<30) return(buy);
if ((CurrentFast < CurrentSlow) && rsi>70) return(sell);