Download MetaTrader 5
To add comments, please log in or register
Deposit to your account via PayPal
dTrader
12
dTrader 2016.01.04 11:03 

This part of the code doesnt work and i wonder why.. The fact is it compile correctly but it doesnt change buylimit orderopenprice() to Bid (or any other price i set).

Can someone please help me?

Thankx


void OnTick()
  {

 int total = OrdersTotal();
    
     for(int cnt = 0 ; cnt < total ; cnt++) {  
       if(OrderSelect(cnt,SELECT_BY_POS)==true) {

         if (OrderSymbol() == Symbol()) {  

             if (OrderType()==OP_BUYLIMIT) {

                  if(OrderOpenPrice()!= Bid){

                     bool olimitbuy=OrderModify( OrderTicket(), Bid, OrderStopLoss(),OrderTakeProfit(), 0, Blue )

                  }

            }

        }

      }

  }

}

Khaled Mohamed
2323
Khaled Mohamed 2016.01.04 21:04  

Hello,

are you sure that it's compiling with you?

you forget a semicolon after the modification call, here it's fixed

void OnTick()
  {

 int total = OrdersTotal();
    
     for(int cnt = 0 ; cnt < total ; cnt++) {  
       if(OrderSelect(cnt,SELECT_BY_POS)==true) {

         if (OrderSymbol() == Symbol()) {  

             if (OrderType()==OP_BUYLIMIT) {
                  if(OrderOpenPrice()!= Bid){

                     bool olimitbuy=OrderModify( OrderTicket(), Bid, OrderStopLoss(),OrderTakeProfit(), 0, Blue ) ;

                  }

            }

        }

      }

  }

}
/
To add comments, please log in or register