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);
}