fxDreema

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

    How to close a part of trade if n % of TP in profit?

    Questions & Answers
    4
    7
    2061
    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.
    • T
      trader.philipps last edited by

      Hi,

      I'm currently struggling with an issue I have no idea yet, how to solve.

      Let's assume I calculate the ATR value and use a multiplier of it either for SL and TP. As an example let's assume ATR is 10 and TP multilpier is 4, which means TP is 40 pips away from open price.
      After a while my trade goes in profit and I want to partly close a defined number of pips (eg. 25% of my TP or in that example 1 initial ATR distance from opening).

      Possible solution 1:
      Get to know how many candles trade is open and recalclate ATR from opening candle, store it in a variable and check if openingPrice + initialATR > than current bit/ask price depending on trade direction.

      Possible solution 2:
      Get the distance between openingPrice and currentTP and divide it by the number (here 4) and check if current ask/bitPrice +/- tpDistance divided by tpMultiplier is > 0

      There may be other solutions, such as storing the TP per trade (ordernumber) as a global variable, which may survive a terminal restart. But I have no idea how to do so with fxdreema.

      I could also open 2 trades and give them a splited lot size with 2 different TPs, but I don't like that approach so much.

      Any ideas or tips I'd really appreciate!

      I like to share my knowledge, but expect the others to contribute as well.

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

        Not sure I understood you. What do you want to close? The whole trade or just some lots?

        (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 0
        • T
          trader.philipps last edited by

          Just a portion of the trade. Is there a function that I can get the number of bars the trade is open already? I'm currently prefering to calculate ATR from trade open again.

          I like to share my knowledge, but expect the others to contribute as well.

          roar 1 Reply Last reply Reply Quote 0
          • roar
            roar @trader.philipps last edited by roar

            @trader-philipps

            https://www.mql5.com/en/forum/114217

            This custom code should do the trick. You can put the code in a "Custom mql code" block in the builder (I don't know how advanced a developer you are, pretty sophisticated strategy for a dude joined 5 days ago lol)

            Need small help? Tag me in your post
            Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

            1 Reply Last reply Reply Quote 0
            • T
              trader.philipps last edited by

              @roar thanks a lot. Never used the custom mql block so far. Didn't expect it to be so easy.
              0_1566955947431_c2adedaa-4886-421f-8e0a-4bf5b23658a2-grafik.png

              Thanks a lot.

              I like to share my knowledge, but expect the others to contribute as well.

              S 1 Reply Last reply Reply Quote 1
              • S
                solidsignalfx @trader.philipps last edited by

                @trader-philipps said in How to close a part of trade if n % of TP in profit?:

                @roar thanks a lot. Never used the custom mql block so far. Didn't expect it to be so easy.
                0_1566955947431_c2adedaa-4886-421f-8e0a-4bf5b23658a2-grafik.png

                Thanks a lot.

                The ea i created was place both buy and sell order at same time how can i correct this i want to add close on reversed signal and trailing loss breakeven how do i solve this problem thanj

                1 Reply Last reply Reply Quote 0
                • T
                  trader.philipps last edited by

                  I think you should start a new thread as this seems to be a new topic.

                  However, you can limit the in the close block that it should apply only to buy, sell or both (default). May that help you?
                  0_1567130082040_Auswahl_506.png

                  I like to share my knowledge, but expect the others to contribute as well.

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

                  Online Users

                  E
                  D

                  12
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors