Add a Delay Between Trades

How do you prevent your EA from placing trades too soon after each other but still allow other functions like trailing stop and closing to go ahead

This video was inspired by a forum post I read a long time ago. I don’t remember exactly where but the question was how to prevent an EA from trading too quickly after placing another trade.

The answers to the question used sleep to introduce a delay after placing the trade. In this case I don’t agree with using sleep as the answer.

Sleep will prevent all further activity by the expert and the expert may also be handling trailing stop, closing existing trades, or other things.

This video shows 2 other approaches, one using a delay by minutes before the next trade and the other uses a delay in bars.

The code is available on GitHub:


  1. Those functions are only placeholders. I said int he video this was only about the trade delay and the remainder of the expert is just a place to put the function.

  2. Hi, could you please tell us how or make a video part two where you explain how to configure these options. UpdateTrailingStop(); // Nothing here yet
    CloseOnCondition(); // Nothing here yet

    void CloseOnCondition() {


    void UpdateTrailingStop() {

    // Nothing here

Leave a Reply