how to open only one position per bar?

 
Hi,
can U tell me how to make an EA open only one position per one bar?

Cause now it looks something like this:


I also don't want to use "if(OrdersTotal<1)" used in many codes because I want to have more than one order opend at a time (but not in the same bar)

Thank for any help,
Jan
 

the code in the post that phy points to is slightly incorrect though, here's a fixed one:

datetime Time0 = 0;
 
void start()
{
  if (Time0 != Time[0])
  {
    OrderSend(...);
    Time0 = Time[0];
  }
}
thank you
 
Thanks a lot Guys - phy and Automated!

Regards,
jan
Reason: