Download MetaTrader 5

Why Desappear

To add comments, please log in or register
Do you know that MQL5 has classes?
Bro840
104
Bro840 2011.02.20 23:22 

What's wrong with this simple piece of code?

In debug it works nicely but when i attach it to the chart the text simply don't appear

Tank you...

 

   MqlRates Quotes[];
   int cont_velas = Bars("EURUSD",PERIOD_MN1);
   CopyRates("EURUSD",PERIOD_MN1,0,cont_velas,Quotes);
  
   CChartObjectLabel InfoGeral;
  
   double var_mensal_perc = (((Quotes[cont_velas-1].close * 100) / Quotes[cont_velas -2].close) - 100);
   double var_mensal_pips = (Quotes[cont_velas-1].close - Quotes[cont_velas -2].close);
  
   InfoGeral.Create(0,"Mensal - Var % " + DoubleToString(var_mensal_perc,2) + "   Var Pips " + DoubleToString(var_mensal_pips,4),0,5,5);
   InfoGeral.Color(Yellow); 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Data Structures / History Data Structure
  • www.mql5.com
Standard Constants, Enumerations and Structures / Data Structures / History Data Structure - Documentation on MQL5
Rashid Umarov
Admin
11812
Rashid Umarov 2011.02.21 07:42  

Use the Detach method from base class CChartObject

  
   InfoGeral.Create(0,"Mensal - Var % " + DoubleToString(var_mensal_perc,2) + "   Var Pips " + DoubleToString(var_mensal_pips,4),0,5,5);
   InfoGeral.Color(Yellow); 
   InfoGeral.Detach(); 
Bro840
104
Bro840 2011.02.21 15:53  
Rosh:

Use the Detach method from base class CChartObject

it's working! ;) nice

 

bu i can't understand the need of use this method. if i say at the moment of object creations that it should be at the chart id "0" and i give it the rigth coordinates....

 

But TANK YOU any way IT´S WORKING :)

To add comments, please log in or register