The values of the shift and iy variables in the above code are not checked for array outliers. Therefore, everything is logical. Check their values before using them, the error will disappear.
And to be more specific, you should know how CountBars and TimeFrame variables are generated.
CountBars =400 and TimeFrame =30, are set statically, in external.
On M30 everything is fine, on M15 it flies out.
How do I check shift and iy for outliers?
if(TimeFrame>Period())
{
ArrayCopySeries(santa1,5,Symbol(),TimeFrame);
summ=CountBars+TimeFrame/Period();
shift=0;
for(int iy=0; shift<summ; shift++)
{
if(iy>ArraySize(santa1))continue;
if(shift>ArraySize(santa1))continue;
if(Time[shift]<santa1[iy]) iy++;//вот эта santa1[iy] "array out of range"
list[shift]=bufbuy[iy];
}
}
Guys, can you tell me why the advisor on Alpari often fails [Invalid volume], although the lot size does not exceed the maximum, trading from 23-45 to 1-00.
I attached the log, there is no such error on other brokers
I am puzzling over how to add a universal (for different instruments) code to calculate the lot for a deal based on % of deposit.
I made it like this:
inputdouble MaximumRisk=0.02; //Риск в сделке от депозита
{Lots = NormalizeDouble(((AccountBalance()*MaximumRisk)/((MathAbs(Price-SL))/Point)/((MarketInfo(Symbol(),MODE_LOTSIZE)*(MarketInfo(Symbol(),MODE_ASK)+Point))
-(MarketInfo(Symbol(),MODE_LOTSIZE)*MarketInfo(Symbol(),MODE_ASK)))),Digits);}
Price ( opening price) and SL (Stop Loss) are calculated separately.
For pairs where quote currency is in dollars (eg EURUSD), for index SPX500 and for gold - all correctly calculated, but for pairs where the dollar is the first in a quote (eg USDJPY) does not work.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The values of the shift and iy variables in the above code are not checked for array outliers. Therefore, everything is logical. Check their values before using them, the error will disappear.
And to be more specific, you should know how CountBars and TimeFrame variables are generated.
CountBars =400 and TimeFrame =30, are set statically, in external.
On M30 everything is fine, on M15 it flies out.
How do I check shift and iy for outliers?
Maybe someone will take the time to look up where the error is.
Maybe someone will take the time to look up where the error is.
Guys, tell me how to add data to a file on a new line
my write function:
this is what I send to it:
I need to add more lines below it:
Guys, tell me how to add data to a file on a new line
my write function:
this is what I send to it:
I need to add more data below the line:
FileSeek() with flag SEEK_END, will help you.
<You substituted in the code
//+------------------------------------------------------------------+to
//+but it didn't help)
Guys, can you tell me why the advisor on Alpari often fails [Invalid volume], although the lot size does not exceed the maximum, trading from 23-45 to 1-00.
I attached the log, there is no such error on other brokers
I have taken the code from the example here and am dealing with it
I defined a method
It complains that it's already defined and has a body.
Question: where is it defined?
I have taken the code from the example here and am dealing with it
I defined a method
It complains that it's already defined and has a body.
Question: where is it defined?
Good evening!
I am puzzling over how to add a universal (for different instruments) code to calculate the lot for a deal based on % of deposit.
I made it like this:
Price ( opening price) and SL (Stop Loss) are calculated separately.
For pairs where quote currency is in dollars (eg EURUSD), for index SPX500 and for gold - all correctly calculated, but for pairs where the dollar is the first in a quote (eg USDJPY) does not work.
Please, what am I missing?