Download MetaTrader 5

Expression has no effect compilation error

To add comments, please log in or register
MQL5 Cloud Network is a distributed computing network. Just give it a try!
Spy_Lord
102
Spy_Lord 2013.06.22 03:56 

Hi,

When I compile my code below, I get the error: 'type' - some operator expected and also 'ORDER_TYPE_SELL' - expression has no effect. It only happens for my 'else' bit which is trying to execute a market order. My limit order works fine and does what I want.

(note: I define stuff like sl, tp, deviation, symbol earlier in the code)

 Thanks for the help! 

 

         if(SymbolInfoDouble(Symbol(),SYMBOL_BID)<close[2])
           {
            request.action= TRADE_ACTION_PENDING;
            request.price = close[2];
            request.type=ORDER_TYPE_SELL_LIMIT;
            request.type_time=ORDER_TIME_SPECIFIED;
            request.expiration=TimeCurrent(dt)+leaveopen*PeriodSeconds();
            OrderSend(request,result);
            lasttradetime=TimeCurrent(dt);
           }
         else
         {
            request.action = TRADE_ACTION_DEAL;
            request.price = SymbolInfoDouble(Symbol(),SYMBOL_BID)
            request.type=ORDER_TYPE_SELL;
            OrderSend(request,result);
            lasttradetime = TimeCurrent(dt);
         }

 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
Andrey Barinov
39239
Andrey Barinov 2013.06.22 08:35  
Spy_Lord:

Hi,

When I compile my code below, I get the error: 'type' - some operator expected and also 'ORDER_TYPE_SELL' - expression has no effect. It only happens for my 'else' bit which is trying to execute a market order. My limit order works fine and does what I want.

(note: I define stuff like sl, tp, deviation, symbol earlier in the code)

 Thanks for the help! 

 

 

request.price = SymbolInfoDouble(Symbol(),SYMBOL_BID);
Spy_Lord
102
Spy_Lord 2013.06.22 15:25  
Wahoo:
That simple! Thanks very much ;)
To add comments, please log in or register