Time constraint

 
How can I make sure that;

Advisor (robot)should open position only if 5 min passed after last position had opened.

Thanks.
 
apleasewouldbenice boom:
How can I make sure that;

Advisor (robot)should open position only if 5 min passed after last position had opened.

Thanks.
Look into using the OnTimer() event? Maybe set it to run 300 sec (5 min) after the last trade 
 
andrew4789:
Look into using the OnTimer() event? Maybe set it to run 300 sec (5 min) after the last trade 
Good idea :) Can you explain more please ?
Thanks for your help 
 
You need to be able to recover after your EA crashes. In order to know the last trade you need to iterate over the history and store the highest order open time in a static variable. Check if the time in this variable is less that five minutes from now. Return false if yes else iterate the pool again and return true if there are no new trades.
Reason: