I backtested an EA I created, but the RSI is not working properly.
I set the open buy to include the condition when the RSI is moving up, but it still opens when the RSI is moving down.
double Buy1_1 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, Current + 1);
double Buy1_2 = 0;
double Buy2_1 = iADX(NULL, 0, 14, PRICE_CLOSE, MODE_MAIN, Current + 0);
double Buy2_2 = iADX(NULL, 0, 14, PRICE_CLOSE, MODE_MAIN, Current + 1);
double Buy3_1 = iRSI(NULL, 0, 14, PRICE_CLOSE, Current + 0);
double Buy3_2 = iRSI(NULL, 0, 14, PRICE_CLOSE, Current + 1);
double Buy4_1 = iClose(NULL, 0, Current + 1);
double Buy4_2 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
double Buy5_1 = iClose(NULL, 0, Current + 1);
double Buy5_2 = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
double Buy6_1 = iSAR(NULL, 0, 0.02, 0.2, Current + 0);
double Buy6_2 = iSAR(NULL, 0, 0.02, 0.2, Current + 1);
double CloseBuy1_1 = iSAR(NULL, 0, 0.02, 0.2, Current + 0);
double CloseBuy1_2 = iSAR(NULL, 0, 0.02, 0.2, Current + 1);
if (Buy1_1 > Buy1_2 && Buy2_1 > Buy2_2 && Buy3_1 > Buy3_2 && Buy4_1 > Buy4_2 && Buy5_1 > Buy5_2 && Buy6_1 > Buy6_2) Order = SIGNAL_BUY;
if (CloseBuy1_1 < CloseBuy1_2) Order = SIGNAL_CLOSEBUY;
http://www.mindreality.com/files/trading/rsierror.jpg
I have attached the MQL file of my EA below so you can check the code. I backtested it on the 15 min EUR/USD chart and it opens a buy order even when the RSI has just gone DOWN.
I set the open buy to include the condition when the RSI is moving up, but it still opens when the RSI is moving down.
double Buy1_1 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, Current + 1);
double Buy1_2 = 0;
double Buy2_1 = iADX(NULL, 0, 14, PRICE_CLOSE, MODE_MAIN, Current + 0);
double Buy2_2 = iADX(NULL, 0, 14, PRICE_CLOSE, MODE_MAIN, Current + 1);
double Buy3_1 = iRSI(NULL, 0, 14, PRICE_CLOSE, Current + 0);
double Buy3_2 = iRSI(NULL, 0, 14, PRICE_CLOSE, Current + 1);
double Buy4_1 = iClose(NULL, 0, Current + 1);
double Buy4_2 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
double Buy5_1 = iClose(NULL, 0, Current + 1);
double Buy5_2 = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
double Buy6_1 = iSAR(NULL, 0, 0.02, 0.2, Current + 0);
double Buy6_2 = iSAR(NULL, 0, 0.02, 0.2, Current + 1);
double CloseBuy1_1 = iSAR(NULL, 0, 0.02, 0.2, Current + 0);
double CloseBuy1_2 = iSAR(NULL, 0, 0.02, 0.2, Current + 1);
if (Buy1_1 > Buy1_2 && Buy2_1 > Buy2_2 && Buy3_1 > Buy3_2 && Buy4_1 > Buy4_2 && Buy5_1 > Buy5_2 && Buy6_1 > Buy6_2) Order = SIGNAL_BUY;
if (CloseBuy1_1 < CloseBuy1_2) Order = SIGNAL_CLOSEBUY;
http://www.mindreality.com/files/trading/rsierror.jpg
I have attached the MQL file of my EA below so you can check the code. I backtested it on the 15 min EUR/USD chart and it opens a buy order even when the RSI has just gone DOWN.
Attached File(s)
MyEA.mq4
10 KB
|
354 downloads