Sleep() on Loss

 
Hi all,

What I 'm trying to achieve is that I don't want the EA to enter on
the same bar that it took a lost. I can't figure it out.How would one
do to put EA on sleep() for like 10 minutes if last trade was a lost?

Help would be appreciated. Thanks.

Maxime Chartrand.
 
You need for flag.
Flag set if position opened.
If flag is set then another position cannot be opened
If new bar begins then flag reset.
datetime time_flag; int init() { time_flag=0; ... } int start() { ... if(Time[0]!=time_flag) time_flag=0; ... if(time_flag==0) { OrderSend(blah-blah-blah); time_flag=Time[0]; } ... }
 
Thank you Stringo,

Is it possible to find if the close was because of "Stop-Loss"? or because of "Take-Profit"?

I would like to use the flag only in Take-profit and not in Stop-Loss.

Thank you very much
 
Analyze comments of closed orders for "[sl]" and "[tp]" substrings
Reason: