Files
mql5-skills/skills/mql5/references/docs/34-standardlibrary/2138-standardlibrary-chart-object-classes-cchartobject-cchartobjectattach.md
T
2026-06-23 21:47:51 +08:00

55 lines
985 B
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Attach
Attaches a graphical object to an instance of the class.
```
bool  Attach(
   long    chart_id,     // chart ID
   string  name,         // name of the object
   int     window,       // chart window
   int     points        // number of points
   )
```
Parameters
chart_id
[out]  Chart identifier.
name
[in]  Name of the graphical object.
window
[in]  Chart window number (0 main window).
points
[in]  Number of anchor points of the graphical object.
Return Value
true - success, false - cannot bind the object.
Example:
```
//--- example for CChartObject::Attach 
#include <ChartObjects\ChartObject.mqh> 
//--- 
void OnStart() 
  { 
   CChartObject object; 
   //--- attach chart object  
   if(!object.Attach(ChartID(),"MyObject",0,2)) 
     { 
      printf("Object attach error"); 
      return; 
     } 
  } 
```