modify ea code

 

hi all, I found an helpful free Expert which closes orders after a set time, unfortunately it delete too pending orders!

I would like it to close only the opened trade.

Someone know how to solve this problem changing the code?

thanks

 
  1. You can't close pending orders, you have to delete them.
  2. So fix it. Comment out the delete call. You haven't stated a problem. Show us your attempt (using CODE button) and state the nature of your problem.
              No free help
              urgent help.
  3. Next time write a better title so it can be searched for.
 
Paul9:

hi all, I found an helpful free Expert which closes orders after a set time, unfortunately it delete too pending orders!

I would like it to close only the opened trade.

Someone know how to solve this problem changing the code?

thanks

If you just don't want the Expert to delete pending orders you should delete this block from your code.

    if (OrderType()>1 && OrderType()<6) {//pending orders
     result=OrderDelete(OrderTicket());
     if (result) Print("TimeBasedSL(): **** Pending Order ticket "+OrderTicket()+" (opentime: "+TimeToStr(OrderOpenTime())+") deleted (timebased SL="+DoubleToStr(TimeBasedSLperiod,2)+" "+smode+")");
    }
 
Petr Nosek:

If you just don't want the Expert to delete pending orders you should delete this block from your code.

Ciao Petr, thank you very much!! really kind!

I will make the change immediately!

Reason: