fxDreema

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

    Combine multiple profit values within the same bar to form an added numerical value in the chart.

    Questions & Answers
    3
    7
    1384
    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.
    • R
      Rupp last edited by Rupp

      Good evening,
      Every time I close a trade, I want to see the respective profit / loss on the chart as a numerical value. That works fine too. But only if only one trade per bar is closed. If multiple trades are closed in the same bar, only the value of one of the closed trades in this bar can you see. How can I change this? It would be best if the profit values of all trades that were closing in a bar would be added to a single numerical value.
      In the two attached screen shots you can see what I mean. How can I solve this best?
      Many thanks for your help
      Rupprecht!
      0_1575417051125_Zwischenablage-2.jpg
      1_1575417051125_Zwischenablage-3.jpg

      T 1 Reply Last reply Reply Quote 0
      • T
        trader.philipps @Rupp last edited by

        @rupp I think you have everything you need. Just store the "orderprofit" in a variable and add the profit off all trades in that candle. if candle closes you reset that variable and start again from 0 on the next candle.

        I like to share my knowledge, but expect the others to contribute as well.

        1 Reply Last reply Reply Quote 0
        • R
          Rupp last edited by Rupp

          Thank you, TraderPhillips,
          Can you help me a little further, because I have never done anything like this?
          Maybe with an example? So how do I save all orderprofits of a candle in a variable?
          Do I have to do this in "onTick" or "onTrade?
          And how to reset that variable and start again from 0 on the next candle?

          T 1 Reply Last reply Reply Quote 0
          • T
            trader.philipps @Rupp last edited by trader.philipps

            @rupp Sorry to say, it looked easier as it is. Maybe @miro1360 could have a look as he is more experienced with order and order history than me.

            What I tried to do is to loop through the order history and calculate the candle time of the order close for each trade. Afterwards I wanted to sum all profits from the last close trade (on trade tab).
            However, I didn't find a function that supports me calculating the candle time (which should be the candle open time) or candle ID from an order close time. So maybe there is a different approach.

            I like to share my knowledge, but expect the others to contribute as well.

            1 Reply Last reply Reply Quote 0
            • R
              Rupp last edited by

              Many thanks @trader.philipps
              I'll ask @miro1360 if he can help here.
              Rupprecht

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

                0_1575744883198_fec6933e-b287-4be2-8f84-2bf288351c6b-image.png

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

                1 Reply Last reply Reply Quote 1
                • R
                  Rupp last edited by Rupp

                  Thank you very much Miro,
                  that was exactly what I was looking for. It works very well.
                  The only small note: The two blocks must be placed in "on Trade" and not in "on Tick".
                  Hopefully it will benefit another user.

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

                  Online Users

                  N
                  F
                  M
                  A
                  L
                  O
                  S
                  E
                  J
                  D
                  M
                  X

                  25
                  Online

                  146.6k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors