"old" source code getting "is not an expert"

 

hello mql engineers,


I compiled a code with newest version of MT4, when load it it report "is not a script"

this source code is writtern last month, and compiled no problem and works well with last month' updated mt4,

today,  I download new version MT4, and compiled it , still no problem without any warning,  how to fix this problem ?

no syntax error , why cannot ?

I give my code, its very simple.

I tried 2 version of MQ4 compiler and 1 version of MQ5 compiler

ex4 generated no problem, no error report.

But 2 ex4 by MQ4 compiler cannot excuted by mt4 teminal, report "its not a script"

ex4 generated by MQ5 compiler works OK, 

I think  MQL is doing something ****

int start()
{
 int cnt, total;
 total=OrdersTotal();
 int type   = OrderType();
     bool result = false;
 
 for(cnt=total-1;cnt>=-1;cnt--)
  {GlobalVariableSet( "tradeif", false);
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
//if(StringFind(OrderComment(), "10608736", 0)==-1 ) continue;
if(OrderSymbol()!="US500" )  continue;
 switch(type)
    {
      //Close opened long positions
      case OP_BUY       : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
                          break;
      
      //Close opened short positions
      case OP_SELL      : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
                          break;

      //Close pending orders
      case OP_BUYLIMIT  :
      case OP_BUYSTOP   :
      case OP_SELLLIMIT :
      case OP_SELLSTOP  : result = OrderDelete( OrderTicket() );
    }
    
    if(result == false)
    {
    //  Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() );
      Sleep(3000);
    }  

}  

 return(0);
 }
 
Please use the Code button (Alt + S) when pasting code. I have edited it for you this time.
 

it is probably a script

 
Soewono Effendi:

it is probably a script

sure ,its a script I have using for years , its simple.


mt4 new version recognize it as unknown.

 
noChangepromise:

sure ,its a script I have using for years , its simple.


mt4 new version recognize it as unknown.

Try using void OnStart instead of int start

 
Keith Watford:

Try using void OnStart instead of int start

OnStart() solve the problem, could mql team give a list after update their mt4 core.


so we can find where is the problem by self

 
noChangepromise:

OnStart() solve the problem, could mql team give a list after update their mt4 core.

so we can find where is the problem by self

That's OK, no thanks are necessary.

Reason: