Correct usage of CChartObjectHLine standard library


Hello everyone, everything good?

I'm using the standard library to handle "CChartObjectHLine" lines

In this parent class "CChartObject" we have the ability to write the line settings to a file using the method

virtual bool Save(const int file_handle);

Now I would like to open this configuration in a graph that has been started and is blank using the method

virtual bool Load(const int file_handle);

But this is not possible, because the Load method depends on the "m_chart_id" variable being filled

if(file_handle==INVALID_HANDLE || m_chart_id==-1)

How to fill this variable without adding an object to the graph?

Since the "CChartObject" class declares this property in "protected"

        long m_chart_id; // identifier of chart the object belongs to

Should the class have a method to set this property? Or am I doing something wrong?

In my code I'm doing it like this

#include <ChartObjects\ChartObjectsLines.mqh>

CChartObjectHLine THLineMTG;


If I'm wrong, can you help me with my doubt!?

Thank you very much