fxDreema

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

    Custom Indicators/Working with Buffers

    Questions & Answers
    3
    23
    13094
    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.
    • K
      kingfathom last edited by

      Hey, there

      From what i could find from the forum, I would make my buy and sell conditions from signals coming from the buffers of my custom indicator.
      Having uploading the indicator into fxdreema's My indicator's list and setting the inputs and outputs, i'm still not sure if the signal is being read.
      I've played with the trace activity block to no avail.. I've also tried using the check object color block

      It's a basic Trend indicator, red for sell (1) and blue for buy (0). 1 and 0 being the color buffers values. I've attached a screenshot of the input list and buffer values

      how would i ensure that I'm receiving signal from the indicator?
      whats the best block then, to create a buy or sell logic based off the buffers values?

      inputs.jpg
      buffers.jpg

      ......
      buffers.jpg
      inputs.jpg

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

        Condition block is mostly used, but there are few other special blocks for indicators in Conditions for Indicators category. But first you need to know what kind of values this indicator is giving to the EA, which can be done with the Trace block: https://fxdreema.com/demo/mt4-trace-multiple

        1 Reply Last reply Reply Quote 0
        • K
          kingfathom last edited by

          Ok awesome thank you!
          I am able to trace activity of the indicator, however I'm still unsure of how to use a condition to trade with it.
          I've tried using the 'indicator is visible' block to activate a trade where buffer 0 is blue and buffer 1 is sell. It isn't making trades however and I'm unsure of what condition would apply to an indicator changing color.

          1 Reply Last reply Reply Quote 0
          • K
            kingfathom last edited by

            Also, this iCustom function was posted on the indicator's website. Not sure if this clarifies our situation at all.

            //---- Read value from trend and signal buffer
            int start()
            {
            // Read values
            double trend = iCustom(Symbol(), Period(), "PZ_LopezTrend_LICENSENUM", 5, 1);
            double signal = iCustom(Symbol(), Period(), "PZ_LopezTrend_LICENCESUM", 6, 1);
            // Do something
            if(trend == OP_BUY) { /* Your code if trend is currently bullish / }
            if(trend == OP_SELL) { /
            Your code if trend is currently bearish / }
            if(signal == OP_BUY) { /
            Your code for bullish trend change / }
            if(signal == OP_SELL) { /
            Your code for bearish trend change */ }
            // Exit
            return(0);
            }

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

              Most indicators return values such as 1.2345 (the price at the moment) or between 0 and 100 if they are oscillators. If this indicator gives you values like OP_BUY and OP_SELL, okay, work with these values. OP_BUY is 0 and OP_SELL is 1 if you don't know, these are predefined constants.

              1 Reply Last reply Reply Quote 0
              • K
                kingfathom last edited by

                Ok great that makes a lot of sense! I understand that 0 is buy and 1 is sell, however what would these values be comparing against in a condition block?

                Here's is an example of the logic I've tried to no success.

                https://fxdreema.com/shared/pX9XFAzre

                I really appreciate your help, been pulling my hair out over this for awhile.

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

                  Better use Condition block. Indicator vs Value-Numeric. But just in case, test this indicator with Trace, to be sure that these are the values you get (here is how to use it: https://fxdreema.com/demo/mt4-trace-multiple)

                  1 Reply Last reply Reply Quote 0
                  • K
                    kingfathom last edited by

                    Ok so after tinkering around with the indicator, it turns out the buffers were mislabeled.
                    Instead of 0 being buy and 1 being sell, it ended up being 5 buy and 6 sell.
                    comparing it with a numeric value started to generate trades!
                    Thanks again for your guidance 🙂

                    1 Reply Last reply Reply Quote 0
                    • K
                      kingfathom last edited by

                      Hello again

                      So the plot thickens. Currently, the lopez indicator will send a buy and sell signal via buffers 5 and 6 with values of 1.00 (Ex. When buffers 5 == 1, buy). This works perfectly.
                      When looking at the data window on mt4, it shows that when the indicator changes state, buffer 7 == 1. Our condition is therefore when buffer 7 == 1, close buy trades and when
                      buffer 7 == 0, close sell trades.
                      The issue, is that the trades do not ever close when referencing this indicator. When there is a buy and sell condition that doesn't reference the indicator, suddenly the close condition that IS referencing buffer 7 starts closing trades correctly. This leads us to think that a buy/sell and close can't reference the same indicator.

                      Our question is, could there be interference happening between the buffers? Can their signals get crossed? Having the buy/sell work and the close not work, and then in a duplicate ea having the buy/sell not be related to the indicator and having the close suddenly work seems illogical.

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

                        __Hello again

                        So the plot thickens. Currently, the lopez indicator will send a buy and sell signal via buffers 5 and 6 with values of 1.00 (Ex. When buffers 5 == 1, buy). This works perfectly.
                        When looking at the data window on mt4, it shows that when the indicator changes state, buffer 7 == 1. Our condition is therefore when buffer 7 == 1, close buy trades and when
                        buffer 7 == 0, close sell trades.
                        The issue, is that the trades do not ever close when referencing this indicator. When there is a buy and sell condition that doesn't reference the indicator, suddenly the close condition that IS referencing buffer 7 starts closing trades correctly. This leads us to think that a buy/sell and close can't reference the same indicator.

                        Our question is, could there be interference happening between the buffers? Can their signals get crossed? Having the buy/sell work and the close not work, and then in a duplicate ea having the buy/sell not be related to the indicator and having the close suddenly work seems illogical.[/quote:7bcn8apu]

                        ===========================================================================================================================================
                        So what I'm trying to understand from what you are trying to say, did you get the lopez trend indicator to buy when the trend goes blue and to close the trend goes red and soon after when the trend goes red to sell and when the trend goes blue to close and rebuy?

                        https://fxdreema.com/forum/viewtopic.php?f=2&t=4098

                        check out my forum because I'm trying to do the same thing with this indicator. Could you possibly help me out?

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

                          Interference... no, I don't believe that 😕

                          1 Reply Last reply Reply Quote 0
                          • K
                            kingfathom last edited by

                            Ok so a few people have private messaged since this post, seems that a lot of people are having issues with custom indicators, or more specifically good ole Lopez.
                            To everyone asking us directly for help, you probably know as much as we do. Using a condition block to compare a buffer in a custom indicator is only working for opens.
                            Closes have no rhyme or reason to how they operate regardless of what logic is applied to it. There are 7 buffers as shown by mt4's data window. Buffers 1 and 2 seems to change when blue or red, buffers 3 and 4 seem to be related to overbought or oversold levels. Buffers 5 and 6 also seem to relate to buy and sell states, with 7 only appearing in the data window when a change between states occurs. All of that being said, opens work great when referencing the buffers, closes (specifically buy closes) don't seem to have any bearing on the buffers shown.
                            This leads me to think there may be an issue with the Lopez code itself, there's no documentation about what the buffers actually represent. I have contacted them and am waiting on a reply.

                            One question I have though is why it seems in the past two days the appear and disappear nodes under conditions for indicators have not updated or saved settings. This is seriously the LAST thing I can think of to make this indicator into a working ea. However, every time it just hangs on "wait..." and doesn't save the settings 😞

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

                              @KingFathom,

                              If you're talking about the waiting and updating part for a, my indicator, I was having the same problem when using an EX4 file from mt4 in the open folder => MQL4 => Indicators. What I found out is that if you use a MQL4 Source File rather than an EX4 file, that is the only way things would work. Because if Lopez was to give the MQL4 Source File than you would have his code and he wouldn't want that.

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

                                If everything works most of the time and sometimes it doesn't, I can blame the server for that. But to be honest, I don't know what it the problem exactly. I wrote to the server support few times in the past for this problem, but of course the guy always say that everything works and there is no problem. Nevermind, these days I will switch to NodeBB and we will see what will happen... it will be better or it will be crash 🙂

                                1 Reply Last reply Reply Quote 0
                                • K
                                  kingfathom last edited by

                                  @ndt113
                                  So what you're saying is that if you do not have access to the .mq4 file then you cannot make an expert advisor with it?

                                  @fxdreema
                                  Ah I see! That makes sense.

                                  So after more prodding, mt4 publishes two errors when trying to live trade with our attempt at an ea.
                                  These errors are:

                                  Global initialization failed
                                  invalid EX4 file (8)

                                  Not too sure why this keeps popping up, all functionality stops after these errors appear.
                                  It looks like in mt4, error code 8 translates to ERR_TOO_FREQUENT_REQUESTS.
                                  Could it be that even though there are "no trade" nodes in place, trades are still being taken on every tick?
                                  What would cause a huge number of requests?

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

                                    @kingfathom

                                    I would assume so

                                    1 Reply Last reply Reply Quote 0
                                    • K
                                      kingfathom last edited by

                                      @ndt113
                                      I find that hard to believe as they advertise an iCustom function on their site to be used in an EA.
                                      I think there's just some sort of communication error.

                                      1 Reply Last reply Reply Quote 0
                                      • K
                                        kingfathom last edited by

                                        I've also posted about this issue on the MQL4 forum and someone mentioned that the error "invalid EX4 file (8)" means that the builder is incompatible with the MT4 terminal build version.
                                        That seems so odd as this error won't appear until at least one trade has been made by the EA.

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

                                          so why is it that they never provide the mql4 file?

                                          Ok tell me this, have you ever uploaded an indicator with ex4 file and without knowing the source code buffers and parametters you were able to type all that information in to get it work?

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

                                          Online Users

                                          E
                                          S
                                          N
                                          O
                                          M

                                          20
                                          Online

                                          146.7k
                                          Users

                                          22.4k
                                          Topics

                                          122.6k
                                          Posts

                                          Powered by NodeBB Forums | Contributors