fxDreema

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

    How to get USD value of a trade closed at stop loss for use in a variable

    Questions & Answers
    3
    9
    1924
    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.
    • C
      clintk last edited by

      I have multiple trades open, one trade closed at loss, in the trade history it show a loss for eg: -11.50$
      How can I get that value? Ie I want to add these up and display the total

      All the blocks that do checks for profit or loss are all comparing it <>= etc to some figure, but how do I get that actual amount?

      I want this amount
      0_1565802265569_175a4227-8d14-4d97-b8a9-6f090f3bd254-image.png

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

        I offered a solution for that in this thread:

        https://fxdreema.com/forum/topic/7616/how-to-calculate-profits-for-current-day-current-week-and-current-month

        (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
        • C
          clintk last edited by clintk

          Ok thanks for the info seems easy enough although in the meantime I got it to work using a "custom MQL code" ontick with the following:

          static int previous_open_positions = 0;
          int current_open_positions = PositionsTotal();
          if(current_open_positions < previous_open_positions) // a position just got closed:
          {
          previous_open_positions = current_open_positions;
          HistorySelect(TimeCurrent()-300, TimeCurrent()); // 5 minutes ago
          int All_Deals = HistoryDealsTotal();
          if(All_Deals < 1) Print("Some nasty shit error has occurred :s");
          // last deal (should be an DEAL_ENTRY_OUT type):
          ulong temp_Ticket = HistoryDealGetTicket(All_Deals-1);
          // here check some validity factors of the position-closing deal
          // (symbol, position ID, even MagicNumber if you care...)
          LAST_TRADE_PROFIT = HistoryDealGetDouble(temp_Ticket , DEAL_PROFIT);
          Print("Last Trade Profit : ", DoubleToString(LAST_TRADE_PROFIT));
          }
          else if(current_open_positions > previous_open_positions) // a position just got opened:
          previous_open_positions = current_open_positions;

          Then I just made the "LAST_TRADE_PROFIT" the variable I can use

          0_1565813067023_0475ea36-2f2f-4a75-a31e-3fd1fda2e049-image.png

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

            Impressive! Congratulations 😉

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

              What about this:
              0_1565892419231_86ed0b2c-d549-458b-a0d3-3b92ebe29a9b-image.png
              To load the last trade only, set that "Not more than..." parameter to 1. The direction is already set to "newest to oldest", so it will start with the newest one. And then get the value in the other block.

              C 1 Reply Last reply Reply Quote 0
              • C
                clintk @fxDreema last edited by clintk

                @fxdreema Thanks but a comment wont help as I need to add them in variables so I could do this, Does that look right? Im only working with sell orders to keep it simple so the filter setting are all for sells only

                0_1565902109791_0a93d9c8-9b7d-4337-b039-911f70ddaae9-image.png

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

                  My next question I want to get a trailing stop loss based on a "breakeven" price point using the losses calculation and have come with the following:

                  For each position will use the last opened order as a reference point and then I want to check if the current open trades profit is more than the losses and record the current price then I want to add 15 pips for a profit above breakeven

                  0_1565903769567_1547b4ed-0020-4185-bddc-59657a931935-image.png

                  Im not sure if that is the right way or if using a formula for the current market price less open price of the last order in loop
                  Lets say the last opened order as a reference point (ie 0 pips) and my breakeven condition is at 20 pips below that order and I want 15 pips profit from there
                  so the trailing stop will need to start from an offset from the open price 35 pips

                  0_1565903838428_248247d2-0a58-46a3-9a1d-243cad75eea0-image.png

                  Am I on the right track or is there another way to do it?

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

                    @clintk said in How to get USD value of a trade closed at stop loss for use in a variable:

                    @fxdreema Thanks but a comment wont help as I need to add them in variables so I could do this, Does that look right? Im only working with sell orders to keep it simple so the filter setting are all for sells only

                    0_1565902109791_0a93d9c8-9b7d-4337-b039-911f70ddaae9-image.png

                    That structure is correct, but be sure TotalLoss_Sells is properly reinitiated when required.

                    (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
                    • l'andorrà
                      l'andorrà last edited by

                      For your second question, how many open trades are supposed to be active at the same time?

                      (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
                      • 1 / 1
                      • First post
                        Last post

                      Online Users

                      B
                      D
                      E
                      J
                      T
                      J

                      20
                      Online

                      146.7k
                      Users

                      22.4k
                      Topics

                      122.6k
                      Posts

                      Powered by NodeBB Forums | Contributors