fxDreema

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

    How to check if EMA crosses candle body or its wick

    Questions & Answers
    candle ema crossover
    2
    8
    3037
    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.
    • X
      xexex007 last edited by xexex007

      I need to buy when 8 EMA crosses candle wick or body (doesnt matter wich wick), but if at the same time 21 EMA crosses same candle or tuches its wick, trade shouldn't open.

      1 Reply Last reply Reply Quote 0
      • J
        john 5 last edited by

        You can create a following condition.

        [Candle crosses 8EMA and 21 EMA > candle high] or [Candle crosses 8EMA and 21 EMA < candle low] I would recommend doing everything with the previous candle to make sure it truly occurred.

        You can also code a desired distance you want 21 EMA to be from the candle using formulas.

        1 Reply Last reply Reply Quote 0
        • X
          xexex007 last edited by

          Will it make difference if i put [Candle crosses 8 EMA and 21 EMA >= candle high] ? Ok lets asume that wick is set up, but how about if it touches the body first without touching or crossing the wick. What should i do in this case?

          J 1 Reply Last reply Reply Quote 0
          • J
            john 5 @xexex007 last edited by john 5

            @xexex007 If you set >= instead of > then it will make a difference. In case of >= trade will be opened when candle high = 21ema which you don't want so stick to the >.

            As for your second question. You should do nothing. The condition will hold. Why? When you code an EA you need to think more in terms of numbers and mathematical expressions rather than visual representation. That is, always numerically describe your visual experience with the chart ... ok but what does that mean in this situation ? What you refereeing to as EMA "touches the body" is the event where the numerical value of EMA at the time t is smaller(higher) than or equal to the candle high(low). If you don't have a wick yet it means that the current price represents the high of the candle in the bullish candle or the low of the candle in the bearish candle. So even if it "touches the body first" the condition
            [Candle crosses 8EMA and 21 EMA > candle high] or [Candle crosses 8EMA and 21 EMA < candle low] will still work. Because it does not matter whether the low/high of the candle is currently or in the prior candle(s) represented by wick or the body. Besides why not try and see it all in the chart;)

            1 Reply Last reply Reply Quote 0
            • X
              xexex007 last edited by

              How should i implement [Candle crosses 8EMA]?

              J 1 Reply Last reply Reply Quote 0
              • J
                john 5 @xexex007 last edited by john 5

                @xexex007 In its simplest version https://fxdreema.com/shared/ATZXgP2pb

                1 Reply Last reply Reply Quote 0
                • X
                  xexex007 last edited by xexex007

                  I am trying to make bot who can trade like this: https://www.youtube.com/watch?v=zhEukjCzXwM&t=627s

                  1 Reply Last reply Reply Quote 0
                  • X
                    xexex007 last edited by xexex007

                    THis is how far i've got thanks to you. Can you make any suggestions or improvements? https://fxdreema.com/shared/a4RaPVdle

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

                    Online Users

                    E
                    K
                    M
                    T
                    A
                    P
                    V
                    R
                    M
                    G

                    23
                    Online

                    146.6k
                    Users

                    22.4k
                    Topics

                    122.6k
                    Posts

                    Powered by NodeBB Forums | Contributors