2008.11.13 21:00:01 Toto USDCADm,M30: ArrayInitialize function internal error

 

Hi,


Got this error. I store ticket number in an array, which i initialize with zeros when orders are closed.


This error appears randomly. The USDCAD order has been closed by EA correctly then this error has been generated. Found nothing in help or doc....


Any help?


Edit : working with version 220.... bug of 220?

 
Show some code.
 
phy:
Show some code.

Array defined as

double tn[];


Here is the close loop with array init at the end.


//---- Close Short
if ( signal==-2 ) //
{
ordtot=OrdersTotal();
for ( i=0; i<ordtot; i++)
{
OrderSelect(i,SELECT_BY_POS);
if ( OrderMagicNumber()==Expert_Id && OrderType()==OP_SELL )
{
// check whether trade context is free
TradeAllow = _IsTradeAllowed();
if ( TradeAllow < 0 )
return(-1);
if ( TradeAllow == 0 )
RefreshRates();
close=OrderClose(OrderTicket(),LotNum,Ask,slippage,Green);
if ( !close )
{
Print("Short Ticket ",OrderTicket()," has close error ",GetLastError(),". Retry in 5 seconds.");
Sleep (5000);
// check whether trade context is free
TradeAllow = _IsTradeAllowed();
if ( TradeAllow < 0 )
return(-1);
if ( TradeAllow == 0 )
RefreshRates();
close=OrderClose(OrderTicket(),LotNum,Ask,slippage,Green);
if ( close )
Print("Short Ticket ",OrderTicket()," has closed successfully.");
else
{
Print("Problem with Short Close - See error code");
return(0);
}
x=0;
ArrayInitialize(tn,0); //==> my famous init error
}
}
}
 
You haven't allocated storage for tn in ths code sample
 
phy:
You haven't allocated storage for tn in ths code sample

for ex if i want to store ten orders i must declare my array like that?


double tn[10];


Thanks for help Phy. :)

 

That might solve your problem.

You can store orders in array elements 0-9 with that declaration.

 
phy:

That might solve your problem.

You can store orders in array elements 0-9 with that declaration.

Testing with this solution. Will update this topic if this error appears again.


Thanks again. :))

Reason: