fxDreema

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

    Closing trade when candle closes below MA not when it ...

    Questions & Answers
    2
    7
    1747
    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.
    • F
      fiftybillion last edited by

      Hi, I am having trouble with closing a trade when candle closes below certain MA. The problem is that the EA closes the position when the price CROSSES the MA and not on the close. If the price keeps on trending I lose out on the trade but I want it to make it so that it closes the trade ONLY when the candle CLOSES below the MA. How can I do this?

      This is only for Long trades.

      Any help is appreciated.

      Thank you so much for this!
      Cheers,

      Ken

      1 Reply Last reply Reply Quote 0
      • F
        fiftybillion last edited by

        I was able to do filter out by using time filter for this.

        I will keep experimenting.

        Thanks

        1 Reply Last reply Reply Quote 0
        • F
          fiftybillion last edited by

          I added onceperbar filter to allow the EA to only check it at the opening of a new candle but sometimes when the opening candle is below the MA it is closes it self.

          Please take a look at picture.

          The position was opened at A and the EA should hold the position until the candle closes below the MA which is C but somehow the EA closes the position at B where the opening of the candle was below the MA.

          The exist program is written like this.
          if trade is running ---> once per bar ---->condition(when the candle is below MA) ----->close each profitable trade.

          What can I do so the EA don't exit at such location. Thanks

          1 Reply Last reply Reply Quote 1
          • F
            fiftybillion last edited by

            ok, i got it to work using another block called every n seconds but I am always looking for better ways of doing things.

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

              The problem is that when block 1 is executed it leads to creating a new trade because of the Buy now block at the end, but then block is executed, which is now true, and it reaches block 18 (Once per bar). But this "Once per bar" is second one and it works independently from the other one, and as a result in one shot you reach to blocks 2 and 5. I'm not sure if there can be situation where both conditions can be true... but anyways. You can use one "Once per bar", maybe on the top, and remove 18,19,20 and 21. Then connect the yellow output of 1 to 5. I didn't tested that and I'm not 100% sure that it's working, but It sounds better to me.

              1 Reply Last reply Reply Quote 0
              • F
                fiftybillion last edited by

                __The problem is that when block 1 is executed it leads to creating a new trade because of the Buy now block at the end, but then block is executed, which is now true, and it reaches block 18 (Once per bar). But this "Once per bar" is second one and it works independently from the other one, and as a result in one shot you reach to blocks 2 and 5. I'm not sure if there can be situation where both conditions can be true... but anyways. You can use one "Once per bar", maybe on the top, and remove 18,19,20 and 21. Then connect the yellow output of 1 to 5. I didn't tested that and I'm not 100% sure that it's working, but It sounds better to me.[/quote:1b726n4i]

                Hi, thank you for your advice.

                I modified the block but unfortunately it did not work 😞

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

                  I want to mention that I prefer to answer small questions rather than building whole projects...
                  So... to see what is going on, I use "Draw arrow" block - connect it after some block and you will se where is this block passing (many arrows will be drawn).
                  I created block "Logic points tester" for that reason actually, so it can be used as well. I only found myself using "Draw arrow", but it's a personal preference.
                  To see values in realtime - "Levels tester..." block is good.

                  By the way I meant connection 1 to 5, not 23 to 5 🙂 Now what you have is... maybe the same as before with less blocks.

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

                  Online Users

                  M
                  A
                  E

                  10
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors