No Errors No Warnings but... - page 2

 
void check_orders_sl_tp()
{
   int i, z;
   for( i=0; i<=orders_total(); i++ ) for( z=0; z<=9; z++ )
   {
      if ( long_orders_array_ATF[i][z] > 0 )//-------- LINE 553 --------------------------------------------------------------------------------
      if ( Order_Select(long_orders_array_ATF[i][z],"History") == long_orders_array_ATF[i][z] )
      {
         if( OrderSymbol()==Symbol() && OrderClosePrice()==OrderStopLoss() )
         {
            if( long_orders_array_ATF[i][0] == OrderTicket()) { long_orders_array_ATF[i][0] = 0; no_other_long_orders_4H = 1;   order_again_long_4H = 1;}
            if( long_orders_array_ATF[i][1] == OrderTicket()) { long_orders_array_ATF[i][1] = 0;                                order_again_long_4H = 1;}
            if( long_orders_array_ATF[i][2] == OrderTicket()) { long_orders_array_ATF[i][2] = 0; long_order_again_1D= 1;        set_enviroment(0,"long",3);}
            if( long_orders_array_ATF[i][3] == OrderTicket()) { long_orders_array_ATF[i][3] = 0; cross_long_order_again_1D = 1; set_enviroment(0,"long",4);}
            if( long_orders_array_ATF[i][4] == OrderTicket()) { long_orders_array_ATF[i][4] = 0; long_HS_order_again_1D = 1;    set_enviroment(0,"long",2);}
            if( long_orders_array_ATF[i][5] == OrderTicket()) { long_orders_array_ATF[i][5] = 0; long_FHS_order_again_1D = 1;   set_enviroment(0,"long",1);}
            if( long_orders_array_ATF[i][6] == OrderTicket()) { long_orders_array_ATF[i][6] = 0; order_again_long_4H = 0; no_other_long_orders_4H = 0; long_non_failure_4H = 0;}
            if( long_orders_array_ATF[i][7] == OrderTicket()) { long_orders_array_ATF[i][7] = 0; order_again_long_4H = 0; no_other_long_orders_4H = 0;}
            if( long_orders_array_ATF[i][8] == OrderTicket()) { long_orders_array_ATF[i][8] = 0; order_again_long_4H = 0; no_other_long_orders_4H = 0; long_non_failure_4H = 0;}
         }.........
 

Line 542

int Order_Select(int ticket, string mode)
{
   int os1, ot2, start = 0;
   
   if ( mode == "History" ) 
   {
        ot2 = OrdersHistoryTotal();
      start = OrdersHistoryTotal() - 100;
      if (start<0) start=0;
   }
   if ( mode == "Trades" ) ot2 = OrdersTotal()+20;
   
   for (os1=start; os1<=ot2; os1++)
   {
      if ( mode == "History" ) OrderSelect(os1,SELECT_BY_POS,MODE_HISTORY);
      if ( mode == "Trades" ) OrderSelect(os1,SELECT_BY_POS,MODE_TRADES);
      if (OrderTicket()==ticket) { os1=ot2+20; return(ticket); } //-----------LINE 542 -----------------------------
   }
   if (!(os1>=ot2+20)) return(-2);
   return(0);
}
 
maleas_k:
Line 553

I suppose the problem is you are trying to read 10000 values in an array of 1000.

if ( file_handle_array > 0 )   {FileReadArray(file_handle_array, long_orders_array_ATF, 0, 10000);
 

It is not that.

Anyway.

Thanks for your time.

I will keep searching.

 
  1. if ( mode == "History" ) OrderSelect(os1,SELECT_BY_POS,MODE_HISTORY);
    
    What are Function return values ? How do I use them ? - MQL4 forum
  2. OrderClosePrice()==OrderStopLoss() 
    Almost never be equal because SL is a market order. The == operand. - MQL4 forum



 

Thank God it was the classic problem of mlq4 that mismatch the errors.

All I had to do was fix all of my for() to match exactly with arrays because of that…

Array out of range" does not cause a critical error *

Ditto, except for the arrays of structures and classes, for which this error is critical one

"Array out of range" is a critical error causing the program to stop

 

Still doesn't play with debug but who cares.

As long as it plays from MT4 strategy tester....

 

Really?

Because this is working perfectly until now.

In market SL and in pending SL.

In Back Tests and live about 1,2 years now.

OrderClosePrice()==OrderStopLoss()
Reason: