fxDreema

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

    Finding the nearest horizontal line of indicator. (Complex question)

    Questions & Answers
    4
    7
    2600
    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.
    • U
      UnicornMadness last edited by UnicornMadness

      Hi ladies and gentlemen,

      I have a question.
      I want to use a custom indicator that draws multiple horizontal lines at different levels.
      See picture below for example. (the 1 pink vertical line I drew myself, such that further on in this post we can assume that currently price is at that vertical line)

      0_1562699496106_finding the lines and values.jpg

      The questions:

      I want the EA (to be built in FXDreema) to find the nearest horizontal line (above current price), and also find the nearest horizontal line (below current price).
      (Note that the lines have their own codename or something like that)

      I want the EA (to be built) to find NOT the horizontal line above current price, but 1 extra level above that. So basically, I want the EA to find the 2nd horizontal line above current price level.
      (and with some other part of the code I want to find the 3rd horizontal line above current price level).

      1. When the lines under #1 and #2 are found, I need to store them somewhere in FXDreema, to also help find the associated price levels of those horizontal lines (and store those as well).

      =============================================================================
      I will donate a symbolic 20 USD to a charity as means of paying forward the good karma, in return for good help, if any. 🙂

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

        This thread can be useful.

        https://fxdreema.com/forum/topic/7463/distance-between-two-objects

        Simply catch all lines you want and put each level into a different variable. Then you can compare each value as you wish.

        (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.

        U 1 Reply Last reply Reply Quote 0
        • U
          UnicornMadness @l'andorrà last edited by

          @l-andorrà

          Thank you for the heads up. It sure is appreciated.

          I saw that thread before.
          Since the indicator plots like 100 of such lines (over a very big price range), it seems it will be a crazy huge task to fetch all lines. However, now thinking of it, I might be able to let the indicator plot only lines in a narrow price range, and hence require less lines to be 'fetched'.

          But here's where I am expecting problems:
          The indicator that draws the lines draws, let's say 5 specific lines in the nearest 400 pip range, with each line its own name, BUT the indicator does the exact same thing for the next upper and lower 400 pip price ranges, so they end up having the same names for the lines. Than how does FXdreema know how to fetch the correct (nearest) line?
          This is why my question was specifically on finding the NEAREST lines (from the indicator) above and below current price.

          Another, not so ideal solution could be to use parts of the indicator code to store values into the EA for the nearest X number of lines, and use those. Still, I believe there should be a way to find the nearest line above (and below) current price.

          Another option is:
          I am missing the point of the thread you suggested 😄

          1 Reply Last reply Reply Quote 0
          • M
            miro1360 last edited by

            to guide you what to do:

            • consider custom code block
            • use an array variable big enough to all the lines
            • find an increment how the name is changed
            • using for loop you can fill this array with each value from all the lines
            • create another loop which will loops through the array of values, use a condition inside the loop to find the position of price, when the condition is true, break this loop and finally you have the "i" increment from the loop ... based on this increment you have the position of your desired values from the array ...

            this is an example based on the steps + in addition it plots the lines (from which it gets the values, for you it is done with indicator, so change the functions accordingly)

            https://fxdreema.com/shared/qfIGAMlVc

            0_1562818331614_c699ba5f-d22a-4d61-bcfe-0c19cba830ac-image.png

            0_1562818484136_0dbf0a3f-7912-43b3-ab7e-36397b1da10b-image.png

            this is only for drawing lines:
            0_1562818529532_a57eb25c-b3f7-4da7-87c9-c24cd59123f7-image.png

            0_1562818559048_8d3c68c5-a23d-48e3-921f-8914c59a36d6-image.png

            0_1562818574701_6165a697-324e-454e-82df-06ca69679454-image.png

            a tolerance should be added (to eliminate price fluctuations around the line, but this is the task where you can play :D)
            ...
            by the way, the whole code can be converted into blocks, but it takes a longer clicking time and I don't have it ... moreover, in my past replies about working with loops is covered almost everything 🙂

            Between trading and gambling is a very small gap, be careful.

            1 Reply Last reply Reply Quote 2
            • M
              miro1360 last edited by

              Someone can play and convert it into blocks, other users can benefit from it 🙂

              Between trading and gambling is a very small gap, be careful.

              U 1 Reply Last reply Reply Quote 1
              • U
                UnicornMadness @miro1360 last edited by

                @miro1360

                Thank you Miro!! Much appreciated.
                In 2 weeks time I will continue this project. Reading what you wrote, I think I will get quite far with your explanation.
                From my understanding, I could even use some MQ4 code from my indicator and put it straight into FXDreema....
                I'll have to do some trial-and-error testing 🙂

                Thanks again!!
                I will uphold my end of the bargain, and pay it forward 😉

                1 Reply Last reply Reply Quote 0
                • C
                  cyberspace last edited by

                  @miro1360 i get errors when i download this and convert it to mt5

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

                  Online Users

                  S
                  E
                  J
                  D
                  M
                  X
                  K
                  E
                  D
                  M

                  23
                  Online

                  146.6k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors