fxDreema

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

    Several conditions needs to be fullfiled to proceed with buy or sell

    Questions & Answers
    5
    8
    2075
    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.
    • L
      Luqmaan @fxDreema last edited by

      @fxdreema i have an idea that might work solve this problem, not sure how to code it.

      So it would work like this.
      Lets call it Candle Range.
      So the idea is that u can customise the candle range. 3, 5, 7, etc.apply a max so that it doesnt take alot of ram

      In addition to this u then have something that counts how many indicators are true within that range and set that. Eg, 3 indicators needs to be true within that candle range before a position gets executed

      So the coding would have a short term memory stored in ram that counts the amount of indicators that are true within that range. And then resets back to zero.

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

        Hello,
        please can you help me to understand how to build EA where several conditions needs to be met one after another and than proceed with buy or sell order ?

        For example here: https://fxdreema.com/shared/zoZQW0fJb

        I would like to wait until MACD signal line crosse above value 0.001, than cross below value 0.001 and than cross below value 0 in order to proceed with sell action. Somehow it`s not working...

        Many thanks in advance.

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

          Under "on Tick" everything happens in a single tick! If Conditions are connected this way, then all must be true at the same time and only then you will reach block 5.

          Recently I worked on something that I called "on Hold" where things works the way you imagine, but the results were very slow and I dropped that work. In MQL4/MQL5 EAs are programmed in such a way that things happen within a single tick, then again on the next tick, then again on the next tick...

          One workaround, is to define some variable and use it to remember the current step of the logic.

          But some things are not needed. If MACD now goes above some level, this also means that just a moment ago it was below that level. And if MACD crosses some level below, this also means that it was above that level second ago. So why do you need to check 2 things when one of these 2 things is well known and it's true 😕

          This level 0.001 is so close to 0, so I don't get your idea 🙂

          L 1 Reply Last reply Reply Quote 0
          • M
            mbagin last edited by

            You right that 3 conditions are not necessary, but at least 2 are required if you want to fulfil idea that MACD needs to cross firstly certain value and than in second step the zero line.

            Is there no way how to setup EA in such way that if condition no.1 was fullfilled (somewhere in the past) than if condition no.2 is fullfileed EA runs an action (buy/sell/etc) ?

            I want to run BUY/SELL only if MACD crossed zero line only if it crossed before certain value i.e. 0.001.

            PS: 0.001 is ok for example in 1Hour frame.

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

              This is the idea: https://fxdreema.com/shared/cC2xjD8Kb
              http://prntscr.com/9s9nc4

              There is one variable with values like 0, 1 or -1
              1 => MACD was < -0.001 and we are ready to check if MACD > 0 and Buy
              0 => Not ready to buy or sell
              -1 => MACD was > 0.001 and we are ready to check if MACD < 0 and Sell

              It can be made with less blocks and connections, but I am presenting the idea.

              Download .mq4 file and then import it into your projects.

              There is also one block "Indicator moves within limits". This one is going back in the history and checks indicator values candle by candle. But I only got the idea that it can be probably used to do the same thing, I was not thinking about how to do it. The downside of looking back in the history on every tick is that the backtest becomes more slower.

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

                Thank you very much. It`s wonderful how your logic is working...

                1 Reply Last reply Reply Quote 0
                • V
                  vistawick last edited by

                  Good day
                  I am also struggling with the similar, i dont know how to connect AND logic block.
                  2 conditions must be met in order to open a buy.
                  condition 1-price must cross above200 SMA (it is used to determine the direction of trend)
                  AND
                  condition 2- price must cross and close above my trendline (trend_line_name)object on chart, then open a buy trade.

                  if price crosses below 200 SMA and condition 2, price cross and close above my trend line ,(do nothing)

                  please see the link https://fxdreema.com/shared/kkJtnpgYb

                  please help, i have been struggling for long time with this one

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

                    No AND blocks are necessary in fxDreema other that to make inexperienced users what is happening in the logic. Just by connecting one condition to the next one you are getting the exact same result with far less blocks.

                    (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 1
                    • 1 / 1
                    • First post
                      Last post

                    Online Users

                    M
                    A
                    M
                    E
                    O
                    O
                    S
                    A

                    16
                    Online

                    146.7k
                    Users

                    22.4k
                    Topics

                    122.6k
                    Posts

                    Powered by NodeBB Forums | Contributors