Issue running old code

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

      //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() );



it is probably a script

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

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.