Trigger Order Limit Excutive MQL4

 

Hi everyone,

Ex: I have 2 order limit ( Buy Limit GOLD 1920 and Sell Limit 1925 )

When the price goes down to match the buy order, is there any way to check if it has matched the order to get information (opening direction) and delete the remaining sell limit order?

Thank you.

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
 
In mql5, i checked trigger with position Ticket but mql4 no support POSITION 
ENUM_POSITION_TYPE GetPositionType()
  {

   for(int pos = 0; pos < PositionsTotal(); pos++)
     {
      ulong posTicket = PositionGetTicket(pos);

      if(PositionSelectByTicket(posTicket))
        {
         string commentArray[];
         int k = StringSplit(PositionGetString(POSITION_COMMENT), ' ', commentArray);

         if(k > 0 && commentArray[0] == botName)
           {
            return PositionGetInteger(POSITION_TYPE);
           }
        }
     }
   return POSITION_TYPE_BUY;
  }
 
    for(int pos = 0; pos < PositionsTotal(); pos++)
     {
      ulong posTicket = PositionGetTicket(pos);

      if(PositionSelectByTicket(posTicket))
        {
         string commentArray[];
         int k = StringSplit(PositionGetString(POSITION_COMMENT), ' ', commentArray);

         if(k > 0 && commentArray[0] == botName)
           {
            return PositionGetInteger 
 
ابوالدهب ابوالدهب #:

thank u, but I still have the problem on mql4 its can't used  Positions

 
Xuan Dat: When the price goes down to match the buy order, is there any way to check if it has matched the order to get information (opening direction) and delete the remaining sell limit order?
  1. There are no positions in MT4, only orders.

    Select the order and check its type. OP_BUY is an open order. OP_BUYLIMIT is still pending.

    bool OrderIsPending(void){ return OrderType() >= OP_BUYLIMIT; }

  2. 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.)

      Don't worry about it unless you're scalping M1 or trading news.

    2. 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.

 
William Roeder #:
  1. There are no positions in MT4, only orders.

    Select the order and check its type. OP_BUY is an open order. OP_BUYLIMIT is still pending.


  2. 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.)

      Don't worry about it unless you're scalping M1 or trading news.

    2. 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.

thank u for  sharing, my issue has resolved

Reason: