How to place a order between two price of same symbol with specific range ?

 

ex:    I have XAUUSD 4 open order

1550

1530

1510

1490

i want to place market order between 1530 and 1510 at 1520 

suggest me code for it

 
  1. Perhaps you should read the manual. Trade Functions / OrderSend - Reference on algorithmic/automated trading language for MetaTrader 5
  2. You haven't stated a problem, you stated a want.

    Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help
              urgent help.

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum

 
William Roeder:
  1. Perhaps you should read the manual. Trade Functions / OrderSend - Reference on algorithmic/automated trading language for MetaTrader 5
  2. You haven't stated a problem, you stated a want.

    Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help
              urgent help.

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum


I have existed order from price 1470 to 1560


1560


1540

1530


1510


1490

1470

i want to place buy stop orders at  1550, 1520,1500,1480 .

in sort wherever EA finds gap of 10 pip between existed stop  or limit orders

not open orders at same price 

i tried below code but it opens unlimited orders at same price 

 {
      double min=0,max=0,profit;
      int type;
      double op, lastlot,ticket;
      for(int trade = OrdersTotal()-1; trade >= 0; trade--)
        {
         if(!OrderSelect(trade,SELECT_BY_POS,MODE_TRADES))
            continue;
         if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=magic1 || OrderType()!=0)
            continue;

         if(OrderOpenPrice() > max)
           {
            max = OrderOpenPrice();
            a=OrderOpenPrice()+1;
          //  b=a+1;
           }
            if(OrderOpenPrice() < min || min == 0)
              {
               min = OrderOpenPrice();
               type=OrderType();
               lastlot=OrderLots();
               ticket=OrderTicket();
               profit=OrderProfit();
              }
        }

if (a!=b)

        {
                      ticket=OrderSend(Symbol(),4,start_lot,max,3,0,0,"",magic1,0,Blue);

        }
     }
Basic Principles - Trading Operations - MetaTrader 5 Help
Basic Principles - Trading Operations - MetaTrader 5 Help
  • www.metatrader5.com
is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels. is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the...
 

Do not double/triple post!

I have removed your new topics as you have had relies here.