I have an issue, could you please give me some hints on how to work around it?
"critical runtime error 502 in OnTester function (array out of range, module Experts\ea.ex5, file MT4Orders.mqh, line 626, col 40)"
It seems like this.Tickets's size only gets increased over time. I assume therefore it is meant to contain information on closed trades. Could you confirm this?
In case this is not necessary, is there a way to turn it off?
I have an issue, could you please give me some hints on how to work around it?
It seems like this.Tickets's size only gets increased over time. I assume therefore it is meant to contain information on closed trades. Could you confirm this?
In case this is not necessary, is there a way to turn it off?
Do you have any idea what could be happening here ?
Library alone compiles without errors, no problems, as usual. Only when trying to compile EA, it throws those errors.
#define ORDER_SELECT (-2)
staticint GetDigits( double Price )
{
int Res = 0;
while ((bool)(Price = ::NormalizeDouble(Price - (int)Price, 8))) // <- LINE 192 so this is apparently a problem "= :: "
{
Price *= 10; // LINE 194
Res++;
}
return(Res);
}
I found something suspicionsin my EA :
union Price
{
uchar buffer[8];
double close;
};
so this union Price name overwrites the Price name in the GetDigits function ? this could be the problem ?
bool isCopyHistory2(string u_symbol, int master_ticket)
{
int ticket_copy;
bool is_exists = false;
// retrieving info from trade historyfor(int i = 0; i < OrdersHistoryTotal(); i++)
{
//---- check selection resultif(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY) == false)
{
Print("Access to history failed with error (", GetLastError(), ")");
continue;
}
// some work with order
ticket_copy = (int)extract_master_ticket(OrderComment());
if(ticket_copy == master_ticket)
{
//print-for-debug
Print("c ticket: ", OrderTicket()); // ==> this is not correct ticket on MT5
is_exists = true;
break;
}
}
//---if(!is_exists)
Print("New Signal #" + (string)master_ticket);
return(is_exists);
}
// List of changes:// 13.03.2019// Add: Added OrderTicketID() - PositionID of an MT5 transaction or MT5 position, and the ticket of a pending MT4 order.
Is it possible there is a memory leak or a more than necessary memory use? Maybe in this.tickets or in this.amount (::ArrayResize) or maybe somewhere else?
The size of the arrays only get increased over time. Is this a must? Is it possible to empty them or perhaps don't load all the previous trades?
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.
I have an issue, could you please give me some hints on how to work around it?
"critical runtime error 502 in OnTester function (array out of range, module Experts\ea.ex5, file MT4Orders.mqh, line 626, col 40)"It seems like this.Tickets's size only gets increased over time. I assume therefore it is meant to contain information on closed trades. Could you confirm this?
In case this is not necessary, is there a way to turn it off?
I have an issue, could you please give me some hints on how to work around it?
It seems like this.Tickets's size only gets increased over time. I assume therefore it is meant to contain information on closed trades. Could you confirm this?
In case this is not necessary, is there a way to turn it off?
Try the latest version. Copy-Paste.
Try the latest version. Copy-Paste.
Thank you fxsaber. It will take me some time to confirm, but so far the memory usage doesn't seem to be lower.
Out of curiosity, where is OrderSwap() defined? I can't seem to find it in the code.
so far the memory usage doesn't seem to be lower.
Need data to reproduce problem. Laconic code and investment access to the trading account where the problem occurs. Maybe in private messages.
Out of curiosity, where is OrderSwap() defined? I can't seem to find it in the code.
So I never got any problems with including this library/code in EAs for years.
Now when I'm compiling MT5 EA, it returns 3 errors from this code, they are all basically about 1 line: ( see code bellow )
in my EA I'm also including:
#import "kernel32.dll"
Do you have any idea what could be happening here ?
Library alone compiles without errors, no problems, as usual. Only when trying to compile EA, it throws those errors.
I found something suspicions in my EA :
so this union Price name overwrites the Price name in the GetDigits function ? this could be the problem ?
so this union Price name overwrites the Price name in the GetDigits function ? this could be the problem ?
This is the reason.
Hi,
Look like have a bug on OrderTicket()
It's not correct ticket from MT5's history
This is my code:
Look like have a bug on OrderTicket()
It's not correct ticket from MT5's history
Apparently you want to get it.
The reasons are detailed here.
Apparently you want to get it.
The reasons are detailed here.
Thanks you very much.
It's ok with
OrderTicketID()Is it possible there is a memory leak or a more than necessary memory use? Maybe in this.tickets or in this.amount (::ArrayResize) or maybe somewhere else?
The size of the arrays only get increased over time. Is this a must? Is it possible to empty them or perhaps don't load all the previous trades?