Simple delay after TP/SL system needed

 

Hello everyone,

I've got just a quick question for You. I would like to modify the script, that would wait certain amount of time (bars) after last TP or SL until opening a new order. 
Unfortunately I couldn't find the solution to my problem. Maybe anyone could help me with that?
I've been using X trader v2 script, but after TP or SL it opens the new order immediately if right conditions are met. It would be perfect if one of You could modify this script for me, because i don't have that much experience with coding.

EA Link: https://www.mql5.com/en/code/10900/page2#comments 

Hope to hear from You soon.

 
oneluckytrader:

Hello everyone,

I've got just a quick question for You. I would like to modify the script, that would wait certain amount of time (bars) after last TP or SL until opening a new order. 
Unfortunately I couldn't find the solution to my problem. Maybe anyone could help me with that?
I've been using X trader v2 script, but after TP or SL it opens the new order immediately if right conditions are met. It would be perfect if one of You could modify this script for me, because i don't have that much experience with coding.

Time to start learning then . . .  Book
 
well great, Now I will have to study a lot, while you can do it in five minutes. :)
 
oneluckytrader: while you can do it in five minutes. :)
Since there are no slaves here, you have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt and the nature of your problem.
 
oneluckytrader:
well great, Now I will have to study a lot, while you can do it in five minutes. :)
How do you know it will take me 5 minutes ?  and why do you expect that I want to donate 5 minutes of my life to you ?
 
oneluckytrader:
well great, Now I will have to study a lot, while you can do it in five minutes. :)

And with that attitude, you will never get anything from the forum, much less a profitable EA...
 

Hi guys,

I have nearly the same problem- I am writing an EA that looks like this:

extern double Lots = 0.1;
extern double Stoploss = 80;

int start()
  {
   double BB, HBB, LBB;
   double i,konec, max, min;
   double LMA, SMA;
   int cnt, ticket, total;
   
   BB=iBands(NULL,60,12,2,0,PRICE_CLOSE,MODE_MAIN,0);
   HBB=iBands(NULL,60,12,2,0,PRICE_CLOSE,MODE_UPPER,0);
   LBB=iBands(NULL,60,12,2,0,PRICE_CLOSE,MODE_LOWER,0);
   konec=iClose("EURUSD",15,1);
   max=iHigh("EURUSD",15,1);
   min=iLow("EURUSD",15,1);
   LMA=iMA(NULL,15,20,0,0,PRICE_CLOSE,0);
   SMA=iMA(NULL,15,9,0,0,PRICE_CLOSE,0);
  
 
   total=OrdersTotal();
    if(total<1)
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
      if((OrderCloseTime()-Time)>20)
      {if ((Ask+20*Point)<LBB)
   
         {ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-Stoploss*Point,BB,"bb-strategy",16348,0,Green);
         if(ticket>0)
            {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
            }
           
          else Print("Error opening BUY order : ",GetLastError());
          
         return(0);
         }
         
       {if ((Bid-20*Point)>HBB)
         {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+Stoploss*Point,BB,"bb-strategy",16384,0,Red);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
           }
         else Print("Error opening SELL order : ",GetLastError()); 
         
         return(0); 
         }
   
        return(0);
      }
   
    
      return(0);}
  


}

 But the time-delay doesn't work at all :( I have no idea what to do, but what I'd like to do is this- take the opening time of the last trade and trade only if the time between the last one and now is an hour..... But I don't know how to select the last order, and than how to make the if statement :( 

 

Could anyone help me, please?? :) 

 
Sorry, I forgot to put the i-
i=OrdersTotal();
Reason: