fxDreema

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

    Save variables/constants if terminal closes/crashes

    Tutorials by Users
    6
    13
    1427
    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.
    • jstap
      jstap last edited by jstap

      Recently I have seen many people asking how to have the EA to remember the values that were used before.

      This link will show how to achieve this, this is for constants, but a variable can be stored in the same way, and MT5 is the same:

      might not work as needed, see below
      https://fxdreema.com/shared/tnu6XI6od

      I had a thought that in a crash this might not work, so I added variables and set them to amend oninit

      https://fxdreema.com/shared/u8jcOuRVc

      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 4
      • l'andorrà
        l'andorrà last edited by

        Very useful, as usual. But shouldn't those blocks be on the 'on deinit' tab instead? Why updating the values all the time and not only when the platform crashed/disconnected?

        (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
        • jstap
          jstap last edited by

          If the value changes the global is updated, this way if the value is changed at any time the latest value is saved, so if the platform crashes and deinit isn't activated, the value is already saved.

          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 1
          • T
            tswaldi last edited by

            Thank you very much for this useful information. What I find very unfortunate is that the default variables are not saved and are lost when the terminal crashes. But fortunately, there are solutions from the community.

            jstap 1 Reply Last reply Reply Quote 0
            • jstap
              jstap @tswaldi last edited by

              @tswaldi 👍

              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
              • A
                alhammeed1990 last edited by

                Thank you for the information. Do you mean that when I set a condition, it must be connected to the terminal variable block?

                1 Reply Last reply Reply Quote 0
                • R
                  rouzbehali last edited by

                  I use a different approach by creating text label objects on the chart in a location that is not visible. These text labels will hold the variables, flags, etc. If my MT4/MT5 crashes and I reload the EAs to the same chart, it will look for those text labels to retrieve the data and continue working.

                  rouzbehdesign

                  T 1 Reply Last reply Reply Quote 0
                  • T
                    tswaldi @rouzbehali last edited by

                    @rouzbehali This is a very interesting approach. Can you share an example? I am still quite new to the subject and am grateful for any opportunity to further develop myself.

                    R 1 Reply Last reply Reply Quote 1
                    • R
                      rouzbehali @tswaldi last edited by

                      @tswaldi https://fxdreema.com/shared/srfHv6Ksc
                      Here's a link to an example project. When EMAs cross up, this EA buys, and when they cross down, it sells. After the buy trade, it assigns the variable "Buy". After selling, it assigns the variable "Sell" and creates a text far away from the corner (1000000 pixels). This text stores the variable value. If your metatrader crashes or you accidentally remove the ea from the chart, simply reload the ea. On init, ea looks for the text. If the text is discovered, ea fills retrieves the variable by checking into the text description.

                      rouzbehdesign

                      T 1 Reply Last reply Reply Quote 1
                      • T
                        tswaldi @rouzbehali last edited by

                        @rouzbehali Thanks for the example. I think it is really the simpler solution. I have understood the logic and will try to integrate it into my EA soon to test it in practice. I will report on the success.

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

                          Hello @jstap Thank you very much for your work, I´m little newbie and I have a question, what exactly should I put in the "Text (code imput): "GDIST"+"Magic "+MagicStart+"Acc "+AccountNumber(), exactly like this? Or maybe as I understand tehe same but with my account number like: "GDIST"+"Magic "+MagicStart+"Acc "+XXXXXX?

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

                            This depends on what you want to record, every+ means save the next data, things like AccountNumber() are standard meta trader functions that return your account number, MagicStart is the built in function in FX Dreema that returns your current EA's magic number (the one you see in your inputs), things like "Acc " is just so in the global terminal what things are is shown by the comment.

                            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
                            • Boillot84
                              Boillot84 last edited by Boillot84

                              I tried to do this just to check if works to save the variables correctly. I guess I'm doing something wrong but I'm don't know what exactly 😅 https://fxdreema.com/shared/GrBXfdQ2b

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

                              Online Users

                              S
                              G
                              B
                              F

                              28
                              Online

                              146.6k
                              Users

                              22.4k
                              Topics

                              122.6k
                              Posts

                              Powered by NodeBB Forums | Contributors