fxDreema

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

    Easy to use MT5 indicator for Equity and Balance over time!

    Tutorials by Users
    4
    4
    2243
    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.
    • Q
      QuantEngineer last edited by QuantEngineer

      Hello Everyone, I programmed a small but very effective indicator to track and display the Equity and Balance of MT5 accounts, it can be added to any MT5 EA, just to display Equity and Balance changing dynamically over time as it is trading on the back tester, to make our visualization a lot easier !

      b6f9f6bc-fb10-44d3-b0de-bae7bb0c8aed-image.png

      And here is the source code to be compiled on the native MT5 IDE.

      Have a good weekend and Enjoy !

      //+------------------------------------------------------------------+
      //|                                Indicator: Equity and Balance.mq5 |
      //|                                       Created by Quant Engineer  |
      //|                                            https://www.abfs.tech |
      //+------------------------------------------------------------------+
      #property copyright "ABFS Inc"
      #property link      "https://www.abfs.tech"
      #property version   "1.00"
      #property description ""
      
      //--- indicator settings
      #property indicator_separate_window
      #property indicator_buffers 2
      #property indicator_plots 2
      
      #property indicator_type1 DRAW_LINE
      #property indicator_style1 STYLE_SOLID
      #property indicator_width1 1
      #property indicator_color1 0x00FF00
      #property indicator_label1 "Equity"
      
      #property indicator_type2 DRAW_LINE
      #property indicator_style2 STYLE_SOLID
      #property indicator_width2 1
      #property indicator_color2 0xFFAA00
      #property indicator_label2 "Balance"
      
      //--- indicator buffers
      double Buffer1[];
      double Buffer2[];
      
      
      //--- Custom functions ----------------------------------------------- 
      
      double AccountBalance()
      {return AccountInfoDouble(ACCOUNT_BALANCE);}
      double AccountEquity()
      {return AccountInfoDouble(ACCOUNT_EQUITY);}
      
      //+------------------------------------------------------------------+
      //| Custom indicator initialization function                         |
      //+------------------------------------------------------------------+
      int OnInit()
        {   
         SetIndexBuffer(0, Buffer1);
         PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
         SetIndexBuffer(1, Buffer2);
         PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, EMPTY_VALUE);
         return(INIT_SUCCEEDED);
        }
      
      //+------------------------------------------------------------------+
      //| Custom indicator iteration function                              |
      //+------------------------------------------------------------------+
      int OnCalculate(const int rates_total,
                      const int prev_calculated,
                      const datetime& time[],
                      const double& open[],
                      const double& high[],
                      const double& low[],
                      const double& close[],
                      const long& tick_volume[],
                      const long& volume[],
                      const int& spread[])
        {
         int limit = rates_total - prev_calculated;
         //--- counting from 0 to rates_total
         ArraySetAsSeries(Buffer1, true);
         ArraySetAsSeries(Buffer2, true);
         //--- initial zero
         if(prev_calculated < 1)
           {
            ArrayInitialize(Buffer1, EMPTY_VALUE);
            ArrayInitialize(Buffer2, EMPTY_VALUE);
           }
         else
            limit++;
         
         //--- main loop
         for(int i = limit-1; i >= 0; i--)
           {
            if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   
            
            //Indicator Buffer 1
            if(true //no conditions!
            )
              {
               Buffer1[i] = AccountEquity(); //Set indicator value at fixed value
              }
            else
              {
               Buffer1[i] = EMPTY_VALUE;
              }
            //Indicator Buffer 2
            if(true //no conditions!
            )
              {
               Buffer2[i] = AccountBalance(); //Set indicator value at fixed value
              }
            else
              {
               Buffer2[i] = EMPTY_VALUE;
              }
           }
         return(rates_total);
        }
      //+------------------------------------------------------------------+
      

      Quant Engineer
      www.abfs.tech

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

        Impressive work, as always. Thanks.

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

          Never disappointing. Thanks

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

            It works, thank you very much!

            RGoo

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

            Online Users

            N
            S
            T
            A

            16
            Online

            146.7k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors