Problem previous looping

 

Hello

I have make mt4 panel with button.. I use control (button)..


1st round I click button for make 3 layer grid pending order (Buy Limit)..with gap 150 point each..Its works fine..

Then i click delete button for delete 3 layer pending order (Buy Limit)

Then I want click button again for make 3 layer grid pending order (Buy Limit)... but its problem is that continue buy limit at last price i have made..

I want it to start all over again at the right price (like 1st round)..


Thank You..

   if (id==CHARTEVENT_OBJECT_CLICK && sparam=="buyLimitbutton")PlaceOrderBuylimit();
void PlaceOrderBuylimit()
  {
  
  for (int i=0; i<(int)layeredit.Text(); i++){
  
  buystop_price = buystop_price - (double)gapedit.Text() * Point; 
   
  if(OrderSend(_Symbol,OP_BUYLIMIT,(double)lotedit.Text(),buystop_price,3,Ask-((int)gapedit.Text()*_Point*10)-((int)sledit.Text()*_Point*10),Ask-((int)gapedit.Text()*_Point*10)+((int)tpedit.Text()*_Point*10))==-1)
      Print("unable to place buy order due to \"",ErrorDescription(GetLastError()),"\"");}
   }   
 
Mhd Amran Bin Lop:

OrderSend does not return a bool. It returns the ticket number or -1 if it fails.


Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

 
Keith Watford:

OrderSend does not return a bool. It returns the ticket number or -1 if it fails.


Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

ok...thank you..