fxDreema

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

    Price Not Crossed MA in X Candles

    Questions & Answers
    3
    6
    730
    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.
    • MrDaisyBates
      MrDaisyBates last edited by

      I have a project idea, but I need the logic "price has not touched/crossed an MA in the last X candles (could be 5 or whatever. Not particularly relevant at the moment).

      If I use the cross above block, and change the cross width to 5, then take the false output from that, is that really all it takes?

      So, for longs, Candle Low of CandleID 1 (starting on previous candle), cross above, width 5, take the false output.

      I'm kinda having a hard time with the "cross width" idea mainly. It means that it's crossed above at any point in the last X candles, right?

      Basically, if price is above, and the low touches and penetrates the MA, even if the open and close are above, I would like it to invalidate.

      I'm sorry this question probably seems so simple, but the cross width functionality, though I think I clearly understand it, I'm not feeling confident in that understanding for whatever reason.

      Thanks, peeps! ❤

      1 Reply Last reply Reply Quote 1
      • MrDaisyBates
        MrDaisyBates last edited by

        I've been further experimenting with it (just ran a little EA with a node that has, for buys/above MA, Candle Low, Cross Below, Cross Width: 5, then my MA settings. I took the false output from that. Idea being that it only trades when price has NOT crossed below the MA within the last 5 candles).

        I'm starting to feel like I need to create a custom loop that searches for the last candle that cross above/below, take the candle ID from that candle, and check that it is greater than 5? (Because if it's candleID 7, it's been more than 5 candles?)

        Is this the most proper/correct/only way to accomplish this task? I simply need some logic that allows trades when price hasn't interacted with the MA in X candles (touch or cross).

        1 Reply Last reply Reply Quote 1
        • MrDaisyBates
          MrDaisyBates last edited by

          Bonus points if the method we conclude with has an optimizable input (so I can check if 3 candles is superior to 8 candles, for example).

          1 Reply Last reply Reply Quote 1
          • MrDaisyBates
            MrDaisyBates last edited by

            I'm leaving this here in case someone else runs across it and needs help with something similar.

            I decided to create a custom loop. Roar discussed them with me very in depth over the last few days on this thread if you wish to further your knowledge:

            https://fxdreema.com/forum/topic/10894/scan-historical-data-for-conditions-values?page=1

            Basically, my solution I decided on was similar:

            Set up a variable "loopid" and set up a variable "candlelookbackID" and a constant "CandleLookback

            After my other trade conditions (this is where I'd want to check if the price had violated the MA), I set up condition "loopid <= CandleLookback"

            If true, it adds 1 to loopid and adds one to candlelookbackID (both are defaulted to 0).

            Next block, condition, for longs, Candle Low > MA. In the candleID slot, I put in candlelookbackID for both of these.

            If true, then the output goes back to the "loopid <= CandleLookback". This adds 1 more onto each of my variables and keeps running, one candle back until it hits a candle where the low is below the MA (breaks the loop) or until the loopid is greater than my CandleLookback.

            Therefore, if loopid, when that first block is false (loopid <= CandleLookback), then it places my trade.

            There's an additional block down there, after the buy/sell that resets loopid and candlelookbackID to 0 for the next time.

            I hope this can be of help to someone else!

            Thanks again for all your help, Roar (if you see this)

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

              @cdwilder1 Impressive works from both of you. Congrats!

              (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 2
              • TipsyWisdom
                TipsyWisdom last edited by TipsyWisdom

                could it also have been done using market properties range?

                I'll think of it and post a version sort of how you explained above and see if its similar.

                or possible the Price X Indicator block?

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

                Online Users

                M
                F
                E
                A
                M
                E

                20
                Online

                146.6k
                Users

                22.4k
                Topics

                122.6k
                Posts

                Powered by NodeBB Forums | Contributors