fxDreema

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

    Close all trades when oldest trade is x minutes old

    Questions & Answers
    3
    7
    498
    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.
    • General Melchett
      General Melchett last edited by General Melchett

      Hi everyone

      Total newbie here, would appreciate any implementation tips!

      I have an EA that opens trades and I am trying to create a separate fxdreema EA to close these baskets of trades when the oldest trade in the basket is x minutes old.

      So for example there are 2 trades open, one is 59 mins old, the other is 1 minute old. As soon as the first trade reaches 60 mins the EA closes both trades.

      I think I need the for loop to check the oldest trade, but then do I just need a close all block?

      I am having difficulty defining a condition that compares the age of the oldest trade to whether it is older than x number of minutes.

      And do I need a block for no trades?

      1 Reply Last reply Reply Quote 0
      • General Melchett
        General Melchett last edited by

        Current progress:

        https://fxdreema.com/shared/zh9bvm8Td

        For some reason when I create a loop to find the oldest trade and restrict it to 1 iteration (so the output should be the very oldest), it brings up a trade from 2 days ago, rather than the oldest trade (that is 3 days old). It works if I specify the pair that has the oldest trade in it, but I just need the oldest trade from all the open trades. Anyone have any ideas? This is what it looks like so far
        0_1632376658535_loop.png

        1 Reply Last reply Reply Quote 0
        • General Melchett
          General Melchett last edited by

          This is bizarre, everything else works:

          • newest to oldest (correct)
          • profitable first (correct)
          • profitable last (correct)
          • oldest to newest (incorrect)

          It seems to ignore all the trades on the 'oldest' day UNLESS I specify the symbol. But if I use 'any symbol' it ignores the older trades still?

          jstap General Melchett 2 Replies Last reply Reply Quote 0
          • jstap
            jstap @General Melchett last edited by

            @learningfx You do not need a blue block above pink.

            Learn fxDreema Without the Wait!

            My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

            The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

            Don’t miss out

            Click here➡️ https://mybook.to/fxDreema to get your copy today!

            Enjoy! 😊

            1 Reply Last reply Reply Quote 0
            • General Melchett
              General Melchett last edited by

              OK I worked around it in the end by ensuring symbol was specified. Then the loop would identify the oldest trade and close it (close trade, filter by age), with another close trade box to close the rest in the basket.

              1 Reply Last reply Reply Quote 0
              • General Melchett
                General Melchett @General Melchett last edited by

                @learningfx said in Close all trades when oldest trade is x minutes old:

                It seems to ignore all the trades on the 'oldest' day UNLESS I specify the symbol. But if I use 'any symbol' it ignores the older trades still?

                Appears that I have still much to learn! I assumed 'any symbol' would loop through all open trade symbols, but the symbols MUST be specified. So I have a constant that holds all regular Forex symbols and I specify this constant in the loop. Mystery solved.

                l'andorrà 1 Reply Last reply Reply Quote 0
                • l'andorrà
                  l'andorrà @General Melchett last edited by

                  @learningfx That is weird because 'any symbol' should search for all open trade no matter what symbol is it from. Are you maybe combining forex charts with non forex? Nox forex charts NEED to be defined in the pip size rules because they are not there by default.

                  (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

                  (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

                  (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

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

                  Online Users

                  E
                  S
                  N
                  O

                  21
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors