How to build indicator which shows daily drawdown?

 
Hello, first of all thank you for helping. I just want to create indicator which shows me daily drawdown in metatrader5. How to create it? Thank you. I only have indicator which shows drawdown of current open position. But I need indicator which shows drawdown with period of daily.
 
Then you already know how. What's the problem?
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

  1. DD = current equity - open loosing positions - today's profit from closed positions. Add the closed positions to your code.

  2. MT5:
              Retrieving History Positions - General - MQL5 programming forum #3 (2020)

    MT4:

    1. Do not assume history has only closed orders.
                OrderType() == 6, 7 in the history pool? - MQL4 programming forum (2017)

    2. Do not assume history is ordered by date, it's not.
                Could EA Really Live By Order_History Alone? (ubzen) - MQL4 programming forum (2012)
                Taking the last profit and storing it in a variable | MQL4 - MQL4 programming forum #3 (2020)

    3. Total Profit is OrderProfit() + OrderSwap() + OrderCommission(). Some brokers don't use the Commission/Swap fields. Instead, they add balance entries. (Maybe related to Government required accounting/tax laws.)
                "balance" orders in account history - Day Trading Techniques - MQL4 programming forum (2017)

      Broker History
      FXCM
      Commission - <TICKET>
      Rollover - <TICKET>

      >R/O - 1,000 EUR/USD @0.52

      #<ticket>  N/A
      OANDA
      Balance update
      Financing (Swap: One entry for all open orders.)

 
Comments that do not relate to this topic, have been moved to "Off Topic Posts".