break or stop when open trades

Paul  

Hi

Check OrdersTotal() and don't look to place a trade if >0. If you have pending orders you will have to filter those out.

[Deleted]  

thanks for replay Ruptor

i used this code 

       
 int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");
  if(handle<0) return(0);
  // write header
  FileWrite(handle,"#","open price","open time","symbol","lots");
  int total=OrdersTotal();
  // write open orders
  for(int pos=0;pos<total;pos++)
    {
     if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
     FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime(),OrderSymbol(),OrderLots());
    }
  FileClose(handle);
and nothing happen, should i change any text in it??
Paul  

Hi

The code you posted writes to a file it doesn't place orders. It won't write to the file if there are no oirders so that looks ok if that's what you want.

[Deleted]  

i think that i need another,

my problem is any expert i write for example it open orders by candle close, every candle the expert will open an order, i want to prevent the expert to open more than the first order

i wish that i can find the solution

thank you again

Paul  

Hi

Use this


if(TotalOrders()==0){


Place decsion to trade here -----


}

[Deleted]  

Hi Ruptor

it works, thank you 

can we improve this code to work for each symbol and for daily ? for example : open one order only for each pair, open one order per day

thank you very much

Manoj  
Ruptor:

Hi

The code you posted writes to a file it doesn't place orders. It won't write to the file if there are no oirders so that looks ok if that's what you want.


Hi Ruptor,


Thanks for your codes, it's working well.


-

Manoj