fxDreema

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

    Is possible to use a mql5 indicator in an EA?

    Questions & Answers
    6
    21
    2307
    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.
    • G
      gery last edited by

      Hello,

      I think that the response will be "no" but would be possible to use an indicator that I purchased in mql5 as a custom indicator to make an EA? And what about if it is a free indicator?

      I've tried with a free one and is not recognizing any parameter or output but I'm not sure if it is a problem of the indicator or free products are also blocked to be used if you are not logged in mql5.

      Thanks!

      S 1 Reply Last reply Reply Quote 0
      • S
        sktsec @gery last edited by

        @gery
        It would work well only if you set it right as import indicator in fxDreema. "Right" means correct input parameter type and right number of buffers

        G 1 Reply Last reply Reply Quote 0
        • B
          biztet last edited by biztet

          As long as there is buffers, objects or price levels in the indicator that is readable by fxdreema, it shouldn't be a problem.

          1 Reply Last reply Reply Quote 0
          • G
            gery @sktsec last edited by

            @sktsec

            Thank you for your help!

            If the indicator has some parameter selectors (a list of strings) then the data type i should write would be string or another data type like enum?

            Best regards

            S 1 Reply Last reply Reply Quote 0
            • S
              sktsec @gery last edited by

              @gery
              I think input for most indicators uses bool for true/false, int for integer, double for decimal numbers, string for text. You can enter any of them directly to match yours. I don't know, may be some indicators hide the ENUM details that make you impossible to replicate.

              By the way, many indicators are repaint with unexpected result. In my experience with MT4, using custom indicator make EA less responsive, sometimes to a point of MT4 crash.

              G 1 Reply Last reply Reply Quote 0
              • G
                gery @sktsec last edited by

                @sktsec

                For example, for this indicator, I see on the left that 1st, 2nd and 4th parameter are data type integer. The 3rd one is double.

                indicator parameters.png

                The thing is that the second it's a selector and although it shows the variable as integer the values in the selector are strings. So I don't know what I have to set here as data type (when configuring custom indicator on fxdreema):

                custom indicator fxdreema.png

                1 Reply Last reply Reply Quote 0
                • B
                  biztet last edited by

                  Use enum appliedprice

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

                    As a matter of fact, you could use "int" for "appliedPrice" and numbers (i.e 0,1,2,3,4,5...) for each item in the menu.

                    This is a good way to avoid compiling errors when using multiple indicators within the same EA.

                    G 1 Reply Last reply Reply Quote 0
                    • B
                      biztet last edited by

                      That's also an option, but you can't see the option you are choosing. You'll need to make label or just remember it.

                      1 Reply Last reply Reply Quote 0
                      • G
                        gery @Abade69 last edited by

                        @Abade69 enum error.png

                        I'm getting this error when setting as integer the datatype and compiling... I've tried with 0 and 1 values with the same luck.

                        roar Abade69 2 Replies Last reply Reply Quote 0
                        • roar
                          roar @gery last edited by

                          @gery https://www.mql5.com/en/docs/constants/indicatorconstants/prices

                          it must be exactly "ENUM_APPLIED_PRICE"

                          Need small help? Tag me in your post
                          Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                          1 Reply Last reply Reply Quote 1
                          • Abade69
                            Abade69 @gery last edited by Abade69

                            @gery That's strange, can I have a link to the indicator? I will try directly.

                            BTW I always use an integer type for "AppliedPrice", never had a problem with hundreds of free indicators:

                            a9a9531d-04ed-4ec9-a4ce-3cbc65b601e4-image.png

                            Edit: You also need to change the value of "TimeFrame" to a number if you want to use as integer.

                            G 1 Reply Last reply Reply Quote 0
                            • G
                              gery @Abade69 last edited by

                              @Abade69

                              The indicator is this one:

                              https:// www.mql5. com/en/market/product/57759 (delete spaces)

                              I have changed the datatype of appliedPrice to ENUM_APPLIED_PRICE in the myIndicators section and assigned an integer variable to set the value.

                              Now is backtesting much faster but still is not doing what I want and it's because of the indicator configuration, something is wrongly set yet. If you could show how to configure in the custom indicator section and then what values to write in parameters (if using 0,1,2... or "Close price"), I would really appreciate 🙂

                              Thank you

                              Abade69 2 Replies Last reply Reply Quote 1
                              • Abade69
                                Abade69 @gery last edited by

                                @gery Thanks, I'll test it.

                                1 Reply Last reply Reply Quote 0
                                • Abade69
                                  Abade69 @gery last edited by

                                  @gery Okay, you have to do this:

                                  1. Re-paste your indicator in the "Indicator" folder. If it's under the "market" sub-folder (the one MQL5 market uses to place your downloaded stuff) your EA won't be able to read it and will return a lot of "0"'s.
                                  2. I set it like this in the "my indicator" window inside Fxdreema:

                                  4ffacd53-7ccd-474a-b8b4-5cf94c17bc9a-image.png

                                  Make sure the buffers below are labelled correctly.

                                  1. I made a comment block to attempt and read the buffers, you can download it here: https://fxdreema.com/shared/l4flUoj3 (you can see how the buffers work in the backtester).
                                  • When the indicator is in a downtrend Buffer #3 value is equal to "-1", like this:

                                  58d55f26-762f-4882-a368-ba4818882497-image.png

                                  • When the indicator is in an uptrend Buffer #3 value is equal to "1":

                                  4c7d46d4-49ce-4d6a-870e-b09dd8c48dd8-image.png

                                  The rest of the buffers seem to point at current price levels that the indicator is painting on.

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

                                    When using "int" types the list of options is usually in the same order as the indicator and may start from "0" or "1", for example:

                                    1 = Close Price
                                    2 = Open Price
                                    3 = High Price
                                    4 = Low Price
                                    5 = Median
                                    6 = Typical
                                    7 = Weighted

                                    OR

                                    0 = Close Price
                                    1 = Open Price
                                    ... And so on...

                                    You'll have to backtest with active orders and let the backtest finish to know if the values start from either "0" or "1".

                                    I will prepare a small demo so you can see how it may be used to trigger orders.

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

                                      I finished a very simple demo for trading execution using this indicator (please note that I don't recommend you trade like this in a real account), you can find it here:

                                      https://fxdreema.com/shared/WfOK6fDhb

                                      After a random backtest the MT4 platform will give you the indicator settings it was using for the signals:

                                      image.png

                                      So now we know that appliedPrice = 1 is "Open Price", so:

                                      0 = Close
                                      1 = Open
                                      2 = High
                                      3 = Low
                                      4 = Median
                                      5 = Typical
                                      6 = Weighted

                                      For TimeFrame "0" is equal to "current", and the rest of the list is in order (0,1,2,3,4,5).

                                      The reason why I don't recommend using "enum" is that you don't have the source file where they are enlisted, so you don't have a way to know the correct way of declaring them. The labels may be different from those shown in the site tutorials. And enums may cause conflict when two indicators within the same EA use similar declarations.

                                      G 1 Reply Last reply Reply Quote 1
                                      • G
                                        gery @Abade69 last edited by

                                        @Abade69

                                        Omg I can't thank you enough for the effort you did to help me... ❤

                                        Now it's working perfectly and the EA does what I wanted!

                                        I have tried to see by myself the number of buffers backtesting the indicator but I couldn't see it anywhere. Just in the "color" tab while attaching the indicator to a graph I could see 3 color outputs, nothing else. How did you do it?

                                        It would help me a lot for future developments and I hope that for the rest of the people too, so less people to bother you 🙂

                                        Is it also possible to make an EA from a paid indicator from mql5? Doing exactly the same like we did now?

                                        Thanks!

                                        Abade69 2 Replies Last reply Reply Quote 1
                                        • Abade69
                                          Abade69 @gery last edited by Abade69

                                          @gery Glad to help my friend 😄

                                          To get the buffers of any indicator you can open a "comment" block, just like the one that is provided in the two examples, and then set an "Output buffer" reading for each row:

                                          2.png

                                          I recommend that the output buffers are declared like this for easy recognition:

                                          3.png

                                          I have never tried to read the output of any commercial indicator. I am guessing it's possible to do it, as long as it doesn't have any active protection or very specific limitation (i.e. It uses random objects instead of internal calculations).

                                          1 Reply Last reply Reply Quote 0
                                          • Abade69
                                            Abade69 @gery last edited by Abade69

                                            @gery I almost forgot to tell you that MT4 doesn't add the indicator directly when you start a backtest, so you have to do it manually (drag from menu), and then you start comparing the indicator readings in your chart with the numbers you see in the comment block.

                                            Most indicators have all of their buffers within the first 10 places.

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

                                            Online Users

                                            S
                                            A
                                            B
                                            A
                                            J
                                            D

                                            22
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors