fxDreema

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

    Variables

    Questions & Answers
    3
    12
    3256
    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.
    • Zackry
      Zackry last edited by Zackry

      I Just Realized how helpful the variables could be .
      i am trying to get the loss of last closed trade into pips and save it into a variable, but i cant find any block or setting to do that.
      i am not using the stoploss to close the trade , trade can be closed after a condition, or it could be closed manually , so what i am trying to do is whenever the trade is closed the loss (in pips) is saved into a variable for further reference .
      thanks.

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

        @miro1360 @roar @l-andorrà

        roar 1 Reply Last reply Reply Quote 0
        • roar
          roar @Zackry last edited by

          @zackry Here:https://fxdreema.com/shared/Wfvtkbn6e

          Note the OnTrade tab

          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

          Zackry 1 Reply Last reply Reply Quote 0
          • Zackry
            Zackry @roar last edited by

            @roar thank you very much I am gonna try this, thanks again

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

              @roar hello bro
              its not working i tried a lot variations as well but still not luck

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

                Not tested

                0_1561355965604_fad24c9a-ea70-419d-b43b-d223dca6cf9e-image.png

                Zackry 1 Reply Last reply Reply Quote 0
                • Zackry
                  Zackry @josecortesllobat last edited by Zackry

                  @josecortesllobat thank you bro
                  this method is working and its holding the loss in pips in a variable
                  i tried to use the variable in the new trade's takeprofit but the ea is not placing any tp
                  Take a look:
                  https://fxdreema.com/shared/zdkeP492b

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

                    Hi @Zackry

                    As you mentioned, what I suggested works so I guess the variable "los" should be a negative value.

                    0_1561378971405_f0c0d611-0050-407e-bc67-c64e93deae12-image.png

                    Could you confirm that?

                    If it is a negative value, I would say that you can´t set a negative value as a Take Profit. It does not make sense. But, if this is the case (trying to set a negative value for TP), you just need to convert the negative value into positive. You can do it by using:

                    • a MQL code block with MathAbs function

                    • the adjust field with "*(-1)" [without quotes] in the Take Profit pane on the Sell/Buy blocks

                    • storing the pips lost directly in positive

                    ....

                    Zackry 2 Replies Last reply Reply Quote 0
                    • Zackry
                      Zackry @josecortesllobat last edited by

                      @josecortesllobat thanks bro
                      really appreciate your help

                      1 Reply Last reply Reply Quote 0
                      • Zackry
                        Zackry @josecortesllobat last edited by

                        @josecortesllobat is it possible to keep the loss in variable without using the stoploss?
                        here is what i mean let say ea open a buy trade and if that trade goes to negative the it should keep updating the variable with the most current amount of loss (in pips) , again i am not talking about the stoploos calculation or the calculation after the trade is closed , i am talking about the trade that is running currently and hasnt been closed .

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

                          This might be a starting point

                          0_1561475779289_aa8e4747-a9e6-4de6-9117-8a4fd6a1984b-image.png

                          Each time P/L is below LossPips, LossPips will be updated to the new value.

                          Zackry 1 Reply Last reply Reply Quote 0
                          • Zackry
                            Zackry @josecortesllobat last edited by

                            @josecortesllobat thanks bro, I will give it a go

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

                            Online Users

                            A
                            G
                            Q
                            C
                            T
                            S
                            A
                            M

                            19
                            Online

                            146.7k
                            Users

                            22.4k
                            Topics

                            122.6k
                            Posts

                            Powered by NodeBB Forums | Contributors