fxDreema

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

    Formulas - joining up results

    Questions & Answers
    3
    11
    3276
    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.
    • A
      augostine last edited by

      hello someone help me here,

      How do i construct a block that detects when 3 consecutive loss trades happen within 1 hr

      1 Reply Last reply Reply Quote 0
      • J
        james last edited by

        Hello

        I've constructed 3 formulas. Now I'd like to find the maximum one. In spreadsheet terms, "Max(formula1;formula2;formula3)".

        I may have missed the obvious, and if I have please point me in the right direction!

        Thanks.

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

          These results can be used to compare them with something (using Condition), but unfortunately there is no strong functionality to work in deeper mathematical terms in fxdreema. Well, it is possible to embed MQL code to the project or to create custom blocks, but you have to understand programming a bit.

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

            If this can help... http://fxdreema.com/shared/UM40c1A6b

            1 Reply Last reply Reply Quote 0
            • J
              james last edited by

              Thank you very much for the speedy reply! I'm completely new to trading and MetaTrader, so this web site is a godsend! I only signed up yesterday, but already I'm getting to grips with things, and I feel I'll be taking out a paid subscription based on my experience thus far.

              Thanks again.

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

                Ahaaa.... so, maybe you are trying to do something simple than you think. I can say that this is the way it happens to me - whatever I want to make, I can always make it simple. But it takes a little time and thinking to do that. To make things simple is one of the hardest thing to do actually.

                Because you are new, you can play with this a bit. It's free to try and it's enough. Basic things can be made with 6-7 blocks. Don't try to make something better than NASA. I think the best reason for this to exists is that it makes it possible for someone to try different simple strategies and also to train his logic thinking.

                1 Reply Last reply Reply Quote 0
                • J
                  james last edited by

                  Sorry, I'm back again! 🙂

                  I've created the following shared project to illustrate my query:

                  http://fxdreema.com/shared/RLmTCDBcc

                  So... at 01:00hrs the EA picks up some information using the 3 formulas
                  Then... at 01:15hrs, it checks to see which formula resulted in the highest value (I hope I've understood the logic here - please say if I'm wrong!)

                  ...but where can I store the resulting value coming out of one of the 3 "and" statements? Ideally I'd like it to be a variable, changed daily by this process so that I can use this variable later on.

                  Or am I going totally wrong? 😞

                  Many thanks.

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

                    There is a simple logic like this that can be used:

                    A=0 (initial value)
                    Do next things number of times, so that every time X is different. In your case, do it 3 times for all the values you want to compare.
                    X=whatever
                    If (A>X) then (A becomes X)

                    At the end A will be equal to the highest X from all iterations.

                    This "Formula" block is simple and stupid, but it's useful. Something you may want to know is that you can use the same Result variable in more than one "Formula" block. In other words, many "Formula" blocks can work over the same variable.

                    So you can try this logic with Formulas again. Also, the result variable from Formula blocks can be used somewhere directly (for example in one of the input fields where number exists normally).

                    My example was is case the logic requires to do something when one of the values is bigger than others. If the logic says to only calculate maximum of 3 values, you may only need one variable that holds the value needed.

                    By the way when you connect 2 or more blocks one after another, no AND is needed. This is also the better way to do it because there will be no calculations after the last block in the chain that is false. In the case when using AND block - all of the parallel blocks will be executed. But if you like it visually, it's ok. Simple mathematics will not slow down today's computer so much 🙂

                    Picking up information in time A and calculating it in time B can be not needed, because you can get Open, Low, High, Close from any candle in the past, and from any timeframe. There is a Candle ID parameter, where you give the index of the candle needed. 0 means the current one, 1 is previous, 2, 3, 4...

                    1 Reply Last reply Reply Quote 0
                    • J
                      james last edited by

                      Thank you so much. I'm very grateful. I guess the problem I have is being a spreadsheet user, and not familiar enough with programming logic! I'll go away and work with what you've given me here, which looks like the answer to my issue.
                      Thanks again.;)

                      1 Reply Last reply Reply Quote 0
                      • J
                        james last edited by

                        For anyone else who is looking... from one novice to (perhaps) another...

                        After spending half a day reading "how to program in MQL4" web pages (isn't the internet useful!), I concluded that the best way to get the maximum value (or minimum, or whatever) in a set of formulae was to do some custom coding, which I did in the "Custom MQL4 Code" block available in the excellent FxDreema.

                        So, the image shows what I end up with in the user interface:

                        [attachment=0:20z7n1i0]http://forum.mql4.com/35725 for more information.

                        My especial thanks to Mr fxDreema himself for his help with this.

                        ......
                        formulas.jpg

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

                          To go to the source code while using generator is something that doesn't make much sense. What you are doing is doing it whatever it takes, and that is very good 🙂

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

                          Online Users

                          E

                          9
                          Online

                          146.7k
                          Users

                          22.4k
                          Topics

                          122.6k
                          Posts

                          Powered by NodeBB Forums | Contributors