How Can I delay a trade with 10bar after it has an already existing trade?

 
How Can I delay a trade with 10bar after it has an already existing trade.
 
Check the OrderOpenTime() convert it to a bar number using iBarShift() if that bar number is less than 10 don't place a new trade. Or did you mean something else ?
 
i still can not understand because l do not understand how to use the that function you gave. thank you
 
Mafeng:
i still can not understand because l do not understand how to use the that function you gave. thank you


OK do it in parts First Check the OrderOpenTime()

Do you know how to check the OrderOpenTime() of an open trade

Do it checking with a loop function the OrdersTotal()

means check all open trades and check also if right symbol() and right magicnumber()

Trie to do that first and show how you do that....

convert it to a bar number using iBarShift() you have to do later....

 
Ok l will try that and see if it will work. thank you very much.
 
Mafeng:
Ok l will try that and see if it will work. thank you very much.

Did you click the links I gave and read what was there ? including the examples ?
 
Mafeng:
i still can not understand because l do not understand how to use the that function you gave. thank you
there are only two choices: learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
 
// Find How many bars ago we entered Market, it must be a market order
// returns <0 if error
// return 3 means that we entered 3 bars ago, 0 indicate enter was at current bar
int BarsSinceEntry(int Ticket)
{
int oldticket = OrderTicket();
if (OrderSelect(Ticket,SELECT_BY_TICKET))
   {
   if (OrderType()==OP_BUY || OrderType()==OP_SELL)
      {      
      for (int i=0;i<1000;i++)
         {
         if (OrderOpenTime()>=Time[i] && OrderOpenTime()<Time[i]+Period()*60) { OrderSelect(oldticket,SELECT_BY_TICKET); return (i); }
         }      
      } else { OrderSelect(oldticket,SELECT_BY_TICKET); return(-2); }   
   }
else
   {
   // problem
   OrderSelect(oldticket,SELECT_BY_TICKET); 
   return(-1);
   }
}
Reason: