![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
I am using the following code to retrieve RSI and EMA in an Expert. Can someone check if it is well writen? It is my first EA in MQL5.
Thanks for the help in advance :)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* iRSI Indicator Calculations
**/
double iRSIGet(string TestSymbol)
{
int handle_iRSI=iRSI(TestSymbol,PERIOD_H4,RSI_Period,PRICE_CLOSE);
double RSI[1];
CopyBuffer(handle_iRSI,0,0,1,RSI);
return(RSI[0]);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* iEMA Long Indicator Calculations
*
*/
double iMALongGet(string TestSymbol)
{
int handle_iMA=iMA(TestSymbol,PERIOD_H4,EMA_Long,0,MODE_EMA,PRICE_CLOSE);
double MA[1];
CopyBuffer(handle_iMA,0,0,1,MA);
return(MA[0]);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* iEMA Short Indicator Calculations
*
*/
double iMAShortGet(string TestSymbol)
{
int handle_iMA=iMA(TestSymbol,PERIOD_H4,EMA_Short,0,MODE_EMA,PRICE_CLOSE);
double MA[1];
CopyBuffer(handle_iMA,0,1,1,MA);
return(MA[0]);
}