fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Delay funtcion needed

    Questions & Answers
    3
    4
    1310
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      Eric 0 last edited by

      Hi guys.
      When a trade closes, there needs to be a delay before another trade can be opened. For example, on an hourly chart, I don't want the 2nd trade to open in the same candle in which the first trade closed. I need one or two hours delay before the EA can check for the conditions and open another trade.
      The EA needs to open a trade when a new candle opens. So, when a trade closes in the middle of a candlestick, and the conditions are met for a new trade, the new trade will be opened in the middle of the candle, which is incorrect. So, in order to avoid this, I need to program some sort of a delay.

      Can anyone give me some advice, please? I tried the 'delay' function but it creates a critical error when the EA runs.

      1 Reply Last reply Reply Quote 0
      • vish
        vish last edited by

        Did you try "Skip Ticks" block? That may be of some help

        1 Reply Last reply Reply Quote 0
        • E
          Eric 0 last edited by

          I just tried the "Skip Ticks" block. It messes up a few things because the EA analyses the previous 3 candlesticks before executing a trade. But thanks for the tip, I'm sure I will find a way to figure it out.

          1 Reply Last reply Reply Quote 0
          • fxDreema
            fxDreema last edited by fxDreema

            I would ask for the age of the last trade, something like that:
            0_1550686893968_36a18fb6-d239-4299-9d52-f1289c8640d7-image.png

            This will also work if you restart MetaTrader, because no temporary variables are used.

            Also this block "Check profit (period of time)" can be used I think. The idea is that you can define certain period of time and ask for the profit... to be 0 I guess.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post

            Online Users

            X
            J
            A
            N
            S
            E
            A
            M
            T
            M

            23
            Online

            146.7k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors