• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 7:10pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 7:10pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Order not working properly on demo account 5 replies

Visual backtest result different from non-visual backtest 0 replies

Do you backtest your systems PROPERLY? 0 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: RSI not working properly on Backtest
Exit Attachments

RSI not working properly on Backtest

  • Post #1
  • Quote
  • First Post: Edited at 4:00pm Apr 16, 2010 12:27pm | Edited at 4:00pm
  •  mindreality
  • | Joined Mar 2010 | Status: Member | 338 Posts
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.
Attached File
File Type: mq4 MyEA.mq4   10 KB | 260 downloads
  • Post #2
  • Quote
  • Apr 16, 2010 4:00pm Apr 16, 2010 4:00pm
  •  mindreality
  • | Joined Mar 2010 | Status: Member | 338 Posts
What is wrong? Please help me to backtest the MQL code attached above and see if you notice the EA opening a buy order even when the RSI is going down as well.
 
 
  • Post #3
  • Quote
  • Apr 16, 2010 5:19pm Apr 16, 2010 5:19pm
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts | Invisible
verify the rsi actually went down. It could be that at +1 candles it was 54.4444 and the current candle it was 54.4445. If you click on the target symbol at the top of your mt4 window you can see the actual values for all of the indicators on your chart.
 
 
  • Post #4
  • Quote
  • Apr 17, 2010 1:24am Apr 17, 2010 1:24am
  •  mindreality
  • | Joined Mar 2010 | Status: Member | 338 Posts
Yes, I verified that the RSI actually went down. I hovered my mouse over to check the actual values of the RSI.

On the current bar, the RSI is 54.9176 and the previous bar, the RSI was 64.7172

Try backtesting my EA and see if you notice the buy order taking place even when RSI is going down.
 
 
  • Post #5
  • Quote
  • Last Post: Apr 17, 2010 1:33am Apr 17, 2010 1:33am
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
you can't see the value of the current RSI : iRSI(NULL, 0, 14, PRICE_CLOSE, Current + 0) on the history because this value changes on every tick. what you see on your chart is the final RSI value after the candle close. in this case : iRSI(NULL, 0, 14, PRICE_CLOSE, Current + 1).

the workaround for this is to compare RSI value after candle closed:
double Buy3_1 = iRSI(NULL, 0, 14, PRICE_CLOSE, Current + 1);
double Buy3_2 = iRSI(NULL, 0, 14, PRICE_CLOSE, Current + 2);
 
 
  • Platform Tech
  • /
  • RSI not working properly on Backtest
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022