fxDreema

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

    Formula to know the average price on several positions

    Questions & Answers
    3
    20
    5949
    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.
    • M
      manu22 last edited by

      Hello, I am trying to understand how to calculate the average price on several positions and the unrealised pips of profit.

      Example:

      Trade 1 = 1 lot 1.0000

      Trade 2 = 2 lots 1.0002

      Trade 3 = 4 lots 1.0004

      Current market price 1.0010

      They are all buy trades, obviously the total lot size is 7 lots but how can I make the robot understand what's the average price and what are the unrealised pips?

      Unrealised pips = x

      I would like to know the x value so I can use it in other conditions.

      Thank you in advance to anyone who can do this, it would help me a lot to increase the profitability and lower drawdown.

      1 Reply Last reply Reply Quote 0
      • M
        manu22 last edited by

        https://fxdreema.com/shared/ekL83l7ke

        I came up with this, there is something wrong for sure but I don't get what. Can someone help me?

        Thank you

        1 Reply Last reply Reply Quote 0
        • M
          manu22 last edited by

          For those who don't know how to calculate it but maybe know much better how to translate it into formulas of Fxdreema.

          You should calculate like this

          a. 1 lot buy 1.0001

          b. 2 lots buy 1.0003

          c. 3 lots buy 1.0005

          Average price = (1 x 1.0001 + 2 x 1.0003 + 3 x 1.0005) / (1+2+3)

          Help please

          1 Reply Last reply Reply Quote 0
          • M
            MMF last edited by

            0_1490514383782_Untitled.jpg
            You can do it by block bucket of trades , reach it by condition or fomula and put it in a variable,what you want to do it.

            M 1 Reply Last reply Reply Quote 0
            • M
              manu22 last edited by

              Does this give an average value also considering that they have different volume lot size?

              1 Reply Last reply Reply Quote 0
              • M
                manu22 @MMF last edited by manu22

                @MMF
                I tried it, it works very well but it doesn't consider that trades have different sizes 😞

                This would have been ideal if the trades were all of the same size.

                1 Reply Last reply Reply Quote 0
                • M
                  manu22 last edited by

                  Please FxDreema help I am sure you are able to make the software do that, it would help a lot of others I believe.

                  1 Reply Last reply Reply Quote 0
                  • M
                    miro1360 last edited by

                    I am not sure what exactly you need, but maybe this?
                    0_1490532986868_upload-23619674-36ae-48eb-9e91-2d59e849c261

                    Between trading and gambling is a very small gap, be careful.

                    1 Reply Last reply Reply Quote 0
                    • M
                      manu22 last edited by

                      This is similar to the other solution. It doesn't consider the fact that not all trades have the same size. You made me reflect though, what I need exactly is to know the breakeven point of all buy trades, so I can set the robot to close 10 pips further.

                      1 Reply Last reply Reply Quote 0
                      • M
                        miro1360 last edited by miro1360

                        ok, for different lot size and knowing BE price point, you need manually calculation ... something like this:
                        https://fxdreema.com/shared/467ZcImHb

                        0_1490543211594_upload-c176f95a-e59b-4f91-b81d-c5ff3570c098

                        (swaps, commisions, etc. are not calculated here, but you can do it)
                        I have not tested if it is working ...

                        note, in this case block order numbering is important, if you mix them, it stop working ...

                        and I dont know how easier it can be done ....

                        Between trading and gambling is a very small gap, be careful.

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          MMF last edited by MMF

                          Wonderful miro1360 😄 If you remember I requested the same request from time past.
                          .

                          1 Reply Last reply Reply Quote 0
                          • M
                            MMF @miro1360 last edited by MMF

                            @miro1360 i tried it, it is Perfect 🙂
                            Break even is zero, how adjust break even + 4 pips ?
                            i Put resultSellPrice in modify stops as Take Profit(custom price level) .
                            i tried adjust in Block modify stops but it Ignores the value

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              miro1360 @MMF last edited by miro1360

                              @MMF said in Formula to know the average price on several positions:

                              i Put resultSellPrice in modify stops as Take Profit(custom price level) .
                              i tried adjust in Block modify stops but it Ignores the value

                              try type into adjust this:
                              +4pips

                              and note one thing ... for Buy, TP can be placed above current price, and SL can be placed below current price .... for buy you can not place TP below current price ...

                              Between trading and gambling is a very small gap, be careful.

                              M 1 Reply Last reply Reply Quote 0
                              • M
                                MMF @miro1360 last edited by

                                @miro1360
                                there is no change in the value of the variable and also question mark unable when I mouse over it.

                                1 Reply Last reply Reply Quote 0
                                • M
                                  miro1360 last edited by

                                  than modify it manually in calculation:
                                  0_1490625701104_upload-8ea223bc-e672-4b6e-83b3-e1db3bfa197a

                                  for buy add these pips in digits and for sell subtract it (because logically sell is in profit below open prices) ...

                                  Between trading and gambling is a very small gap, be careful.

                                  M 1 Reply Last reply Reply Quote 0
                                  • M
                                    MMF @miro1360 last edited by

                                    @miro1360
                                    thank you now it`s Ok 🙂 0_1490630204101_Untitled.jpg

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      miro1360 last edited by

                                      dont forget, that for JPY pairs is another quotation, so instead of 0.0004 you need give 0.04
                                      ... or you can instead of this number have this function:
                                      toDigits(4) (where 4 are 4 pips) ... and it can working with all pairs automatically

                                      so result formula will be:
                                      resultBuyPrice=sumPrice/sumLot+toDigits(4);
                                      resultSellPrice=sumPrice/sumLot-toDigits(4);

                                      Between trading and gambling is a very small gap, be careful.

                                      M 1 Reply Last reply Reply Quote 0
                                      • M
                                        manu22 last edited by

                                        This is a great system, I found this that seems easier tell me if it makes sense to you

                                        https://fxdreema.com/shared/GOHeJlHAc

                                        TPB is a constant so it can be modified for each currency pair. It just checks when the trades get over breakeven and if the flag is true, which is only after a trade was opened it draws a horizontal line at the preferred distance.

                                        Trades are closed when price passes the line.

                                        This is done but sadly I had another problem...

                                        If the server is restarted all of my martingale risk management screws up because I use this system:

                                        https://fxdreema.com/shared/iQQPen5Zc

                                        When the server restarts it's a mess and the lots multiply like crazy and make an insane profit or otherwise blow up because the trade size is too big.

                                        Do you have any ideas to multiply volume size from the last opened trade only, or otherwise draw on chart the last trades size so if the server restarts the robot can find it on the chart?

                                        1 Reply Last reply Reply Quote 0
                                        • M
                                          miro1360 last edited by

                                          Lot size from last opened trade you can get with this way:
                                          0_1490646697150_upload-8f179505-b497-4640-ae13-c8cccf58dbcf

                                          Lot size from last closed trade this way:
                                          0_1490646758108_upload-f2f675c8-10e9-4829-9103-e9caad0a9a47

                                          Between trading and gambling is a very small gap, be careful.

                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            MMF @miro1360 last edited by

                                            @miro1360
                                            I have already done by adjust not formula.
                                            thank you very much miro

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

                                            Online Users

                                            E
                                            H

                                            12
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors