Help button Profit & trades

 

Good! I need help, I am trying to create two buttons, one that indicates the current Profit and the other the number of open trades; My problem is that it creates the buttons but it does not update the data, what am I doing wrong?
Thank you very much and sorry for my English.

Code:

***

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Position Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Position Properties
  • www.mql5.com
Position Properties - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Please edit your post and place your code with the "</>" icon on the toolbar (or use Alt-S). Don't just paste your code as normal text. It is difficult to read and follow.
 
xyon126:

Good! I need help, I am trying to create two buttons, one that indicates the current Profit and the other the number of open trades; My problem is that it creates the buttons but it does not update the data, what am I doing wrong?
Thank you very much and sorry for my English.

Code:

***

use this function for change value

ButtonTextChange();

at first copy this one :

bool ButtonTextChange(const long   chart_ID=0,    // chart's ID 
                      const string name="Button", // button name 
                      const string text="Text")   // text 
  { 
//--- reset the error value 
   ResetLastError(); 
//--- change object text 
   if(!ObjectSetString(chart_ID,name,OBJPROP_TEXT,text)) 
     { 
      Print(__FUNCTION__, 
            ": failed to change the text! Error code = ",GetLastError()); 
      return(false); 
     } 
//--- successful execution 
   return(true); 
  } 
 
Mohsen Bjp:

use this function for change value

at first copy this one :

Hello Mhosen Bjp!

I have already found a way to apply what you have taught me, thank you very much.

All the best
Reason: