I only read your code as far as this
int bidprices[20]; int askprices[20]; int prices[20]; for(int i = 0; i < 20; i++){ bidprices[18-i] = bidprices[19-i]; }
When i reaches 19, you are trying to access
bidprices[18-19]
which is
bidprices[-1]
which doesn't exist so you have an array out of range error.
If you checked the journal. you should see this
GumRai:
Thank you for your help. However, the journal did not record that as an error and after I changed it, it still does not work. What should I do?
I only read your code as far as this
When i reaches 19, you are trying to access
bidprices[18-19]
which is
bidprices[-1]
which doesn't exist so you have an array out of range error.
If you checked the journal. you should see this
What have you changed it to?
- simplify and correct
// for(int i = 0; i < 20; i++){ / bidprices[18-i] = bidprices[19-i]; for(int i=19; i > 0; --i) bidPrices[i] = bidprices[i-1];
TicketNumbersell = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"Open Sell",MagicNumber,0,clrRed); Print("Sell Order");
Check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articlesif(prices[i] > prices[i+1]){ highnum++; } if(prices[i] < prices[i+1]){ lownum++; } ////////////// Shouldn't the counting loop be finished here? if(highnum>15){
- GumRai: bidprices[-1]Use #property strict and you would have seen the error.
which doesn't exist so you have an array out of range error.
If you checked the journal. you should see this
- Add print statements before and inside your if statements printing variable values and find out why.
WHRoeder:
My dear friend, I really appreciate your help. I do not quite understand what you mean by 2 and 3 though, can you please explain a bit further?
- simplify and correct
- Check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- GumRai: bidprices[-1]Use #property strict and you would have seen the error.
which doesn't exist so you have an array out of range error.
If you checked the journal. you should see this
- Add print statements before and inside your if statements printing variable values and find out why.

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 sorry to post here, but I am a beginner and I am really stuck. My EA is only 164 lines, so can someone kind please help with me? It can compile without error but it can not run on the backtester of Metatrader4.