time break for EA. Thanks for your help

 

Hi, gurus,



I am trying to let EA stop openning new positions for a few mins after a position is 1. closed by EA itself due to indicator conditions,2. reaching target or stop loss or 3. manual closing.



if ( (TimeCurrent()-OrderCloseTime()<120)) {Print("Wait"); return(0); }

if ((total>0) && (TimeCurrent()-OrderOpenTime()<120)) {Print("Wait for 2 mins"); return(0);}


See above, the 2nd command gets executed, but the first one never gets executed, not even if I put total>0 or orderhistorytotal>0 there.



How can I solve the problem and get a break after Closes as described above?



Many thanks for your help.