Order expiration

 

Hey guys i would aappreciate if you help.

Can someone tell me why my orders are not expirng?



if((Buy_Sell_Signal()=="Buy") && (OrdersTotal() == 0)) Ticket = OrderSend(NULL,ORDER_TYPE_BUY_LIMIT,Lot_Size,(iBands(NULL,0,BB_Period,BB_Deviation2,BB_Shift,BB_Applied_Price,2,0)),0,0,0,"Opened Bolliger Band EA",MN,0);

if((Buy_Sell_Signal()=="Sell") && (OrdersTotal() == 0)) Ticket = OrderSend(NULL,ORDER_TYPE_SELL_LIMIT,Lot_Size,(iBands(NULL,0,BB_Period,BB_Deviation2,BB_Shift,BB_Applied_Price,1,0)),0,0,0,"Opened Bolliger Band EA",MN,0);
   
 
  1. Be careful with NULL.

    On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not, OrderSend does not.

    Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.

  2. On MT4 there is no such thing as

    ORDER_TYPE_BUY_LIMIT
    Only OP_BUYLIMIT

  3. Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

  4. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)

 
William Roeder #:
  1. Be careful with NULL.

    On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not, OrderSend does not.

    Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.

  2. On MT4 there is no such thing as

    Only OP_BUYLIMIT

  3. Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

  4. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)

thank you william!


is there any information about order expire?

 
William Roeder #:
  1. Be careful with NULL.

    On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not, OrderSend does not.

    Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.

  2. On MT4 there is no such thing as

    Only OP_BUYLIMIT

  3. Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

  4. Don't double post! You already had this thread open.
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2017)

i want my order to expire at the close of the candle

 
So set an expiration (datetime) assuming your broker allows it.