Questions from Beginners MQL4 MT4 MetaTrader 4 - page 113

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 need my EA to open all orders (Sell and Buy), even if they are already open and that it would do it not when all conditions converge, but on the next candle!!! Help plz......I am grateful in advance...
At the moment I have this in my code:
{
if(NewBar())
{
// algorithm itself etc.
}
}
bool NewBar()
{
staticdatetimelastbar=0;
datetime curbar=iTime(Symbol(),0,0);
if(lastbar!=curbar)
{
lastbar=curbar;
return(true);
}
return(false);
}
}
Here's the function.
I just thought the problem wasn't in the code as there are no errors in standard mode.
Anyway, no one seems to answer...
Anyway, no one seems to be answering...
There don't seem to be any errors in the function you posted. I am confused by the use of OrderTicket()!=Ticket to sift out adjacent orders with the same ticket. Check and make sure that there are no such orders. If the (69,25) is specified by the compiler , look at position 25 of line 69 - the error is there. Type this one line.
I really wonder what he has in line 69
Phew, thought no one would react.
Here is that part of the code:
66 double Volatility(int _period){
67 double summ = 0;
68 for(int i=1; i<=_period; i++)
69 summ+=MathAbs(High[i]-Low[i])
70 return(NormalizeDouble(summ/_period, Digits))
71 }
Thanks for the tip
Phew, thought no one would react.
Here is that part of the code:
66 double Volatility(int _period){
67 double summ = 0;
68 for(int i=1; i<=_period; i++)
69 summ+=MathAbs(High[i]-Low[i])
70 return(NormalizeDouble(summ/_period, Digits))
71 }
Thanks for the tip.
Everything is clear. The error is in the line summ+=MathAbs(High[i]-Low[i]); counting 25 positions from the edge will probably return to High[i].
I wrote Alert(Low[-1]); the compiler requires a positive number. I wrote int n=-1; Alert(Low[n]); - when executing Array out of rangre. But how can i<0 ??? maybe it's the lack of historical data? check the date interval from ... to ...
PLEASE ADVISE WHICH TRADER TO CHOOSE OR THE EXACT SERVER NAME
Phew, thought no one would react.
Here is that part of the code:
66 double Volatility(int _period){
67 double summ = 0;
68 for(int i=1; i<=_period; i++)
69 summ+=MathAbs(High[i]-Low[i])
70 return(NormalizeDouble(summ/_period, Digits))
71 }
Thanks for the tip
It seems that _period sometimes has a value larger than array items. Hence the array overruns.
Choose one of the options.