Ctrade BuyLimit,BuyLimit Invalid order type error

el3reef  

Hello,


i used to use CTrade class on Buy,Sell functions without any problems

now i need to use BuyLimit,BuyLimit  ,in the first of used i face error expedition time,  I tried to fill the two inputs for the expiration code and I faced another error     "CTrade::OrderTypeCheck: Invalid order type"

example of code that i use 

         trade.BuyLimit(Lot,_Symbol,Ask+.002,0,0,ORDER_TIME_SPECIFIED,(TimeCurrent()+2000000),"cooment ");    
         trade.BuyStop(Lot,_Symbol,Ask+.002,0,0,ORDER_TIME_SPECIFIED,(TimeCurrent()+2000000),"cooment ");

waiting for help

Thanks

William Roeder  
  1. Junior Dream #: Hi Have you found a fix for this please?

    The code is wrong. A Buy Limit price must be below the market, not above.

  2. el3reef: now i need to use BuyLimit,BuyLimit 
    There is no need to create pending orders in code.
    1. The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
    2. Don't worry about it unless you're scalping M1 or trading news.
    3. Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
Reason: