fxDreema

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

    Create EA with partial take profit

    Questions & Answers
    2
    5
    1846
    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.
    • Z
      Zinho last edited by

      I am trying to créate an EA with SL, TP and Parcial TP. Below have an example, I put a simple EA with moving average crosses:

      Example:

      Buy stock Price; $ 20,00
      Stop Loss: 8%
      Take Profit: 10%
      Parcial Take Profit: 5%

      I tested with SL and TP and it is good, but I don´t know how can I put parcial take profit in %. The same with trailling Stop (or break even), I dont know how can I put in %. In pips is easy, but in % I don´t know how.

      Here is an example that I am trying:

      https://fxdreema.com/shared/uWt9FFLWb

      Can you help me?
      Thank you!

      1 Reply Last reply Reply Quote 0
      • J
        josecortesllobat last edited by

        Could you clarify this condition: "Parcial Take Profit: 5%"?

        5% of what: TP, SL?

        1 Reply Last reply Reply Quote 0
        • Z
          Zinho last edited by

          5% of entry price

          1 Reply Last reply Reply Quote 0
          • J
            josecortesllobat last edited by josecortesllobat

            Let's take a look at your Project.

            I have changed the size of the postions (1 lot) and the EA is trading "Once per bar".

            0_1539530229490_ed84fe62-7b32-4468-8082-2557e0b1eced-image.png

            GBPUSD H4
            Entry Price = 1.61728
            SL Price = 1.74666 {= 1.61728 x(8%)} --> 1293.8pips
            TP Price = 1.29382 {= 1.61728 x(-20%)} --> 3234.6pips

            The EA opens the trade as you expect.

            3% of Current SL = 1293.8pips x 3% = 38.81pips --> Partial TP (1) = 1.61728 - 38.81pips = 1.613399

            0_1539530954042_fe1f0330-2b91-48c0-ad3d-63dd3b5d6be1-image.png

            It works as expected. If the EA is evaluated with Every Tick, it would close partially the trade at 1.61335. For this case, it closes the trade partially at the begining of next bar.

            Then, what you would like is a partial trade close when the profit reaches 5% of Open Price.

            Partial TP Price (1) = 1.536416 {= 1.61728 x(-5%)} --> 808.6pips

            The goal is to calculate how many pips belongs to a 5% of the Open Price in profit direction to be used in the "pips away from open-price" block.

            The next might be an approach that works as expected

            0_1539534202846_04fc81f0-7d29-45aa-bbc5-4faa879fb976-image.png

            0_1539534834862_3546ee42-ce66-4cca-b64d-7412c5d66357-image.png

            0_1539534232775_763b23cc-b1d4-45ef-b72c-92082eeaef57-image.png

            0_1539534341973_6e0528c8-83f2-4851-95ff-0cba3378282f-image.png

            https://fxdreema.com/shared/1Bg0OYPTc

            Of course, there are different options to get what you want and fxDreema allows you to investigate easily across many alternatives.

            1 Reply Last reply Reply Quote 1
            • Z
              Zinho last edited by

              Thank you! Regards!

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

              Online Users

              Q
              C
              T
              S
              A
              M
              R
              G
              G
              Y
              C
              S
              S

              27
              Online

              146.7k
              Users

              22.4k
              Topics

              122.6k
              Posts

              Powered by NodeBB Forums | Contributors