fxDreema

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

    How to set conditions on closing trades

    Questions & Answers
    2
    5
    864
    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.
    • B
      Breeeeen last edited by Breeeeen

      Hi everyone,

      How would someone set up a situation where the EA does the following?

      1. Count the total dollar value of all profitable trades
      2. Close all profitable trades
      3. Start closing losing trades (biggest loss first) until the amount closed in losses equals the profits
      4. Skip any trades where it would make the total losses closed to be greater than profit closed

      To use an example, let's say I have 3 winning trades and 4 losing trades:

      Winning trades
      Trade 1 buy profit $5
      Trade 2 sell profit $8
      Trade 3 buy profit $12

      Losing trades
      Trade 4 buy loss $6
      Trade 5 sell loss $7
      Trade 6 buy loss $8
      Trade 7 buy loss $9

      Desired outcome: close trades 1-3 (total closed profit of $25) and then close trade 7, then trade 6, skipping trade 5 (since this would make the losses go over the profit) but closing trade 4 (total closed losses of $23)?

      I tried a proof of concept but it failed to do what I wanted it to (it closed everything):
      https://fxdreema.com/shared/XVQAQMwSb
      (This is in MT5)

      Breeeeen

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

        @breeeeen Are those profit/loss limits supposed to be applied at the same time? I mean, should any trade be closed before those +25 -23 figures are reached?

        (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
        • B
          Breeeeen last edited by

          Hi @l-andorrà, sorry the +25 and -23 were just examples, it should be any number as long as profits are equal to or greater than the losses.

          Breeeeen

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

            @breeeeen Then you will definitely need a loop to search for that. Certaily not an easy one. Is that amount of money supposed to be customizable as an input parameter? I mean, would you select for example 15, so that when profit is +1+ be closed if losses now are -15? And then change that value?

            (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
            • B
              Breeeeen last edited by

              @l-andorrà no that money doesn't need to be customizable, just as long as profits is greater or equal to losses, whatever their values.
              I tried a loop condition, what changes would you make to this example? https://fxdreema.com/shared/XVQAQMwSb (this is in MT5)

              Breeeeen

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

              Online Users

              T
              P
              C
              S
              T
              I
              B
              A
              H

              20
              Online

              146.7k
              Users

              22.4k
              Topics

              122.6k
              Posts

              Powered by NodeBB Forums | Contributors