How do I learn to create graphical objects? MQL4. - page 4

 
Integer:

Before creation, you can check if the object exists, ObjectFind() function. You don't need to do anything, it exists and it's OK, no big deal.

A set of objects. You can add bar time to the object name, and get a unique name.

Trim the beam. The ObjectSet(Name,OBJPROP_RAY,false) property;

Wow, I've read your thoughts. Already done. Assigned the name to the current time.

Trimmed the beam. That is, remembering the old name put a false one?

 
forexman77:

...

Cut the beam. You mean remembering the old name puts a faux pas?

Immediately after creation, call ObjectSet() with the same name with which creation was performed.
 

Trying to draw objects in the Expert Advisor, indicator subwindow (MQL4)

The indicator is the same, it means that subwindow should be number 1.

long   chart_ID=0;        // ID графика
int win_idx=1;
string nameobj=TimeToStr(Time[0]);       
            //--- сбросим значение ошибки
            ResetLastError();
            //--- создадим трендовую линию по заданным координатам
           if(!ObjectCreate(chart_ID,nameobj,OBJ_TREND,win_idx,Time[index],maximum1,Time[1],TRENDmax[1]))
            {
            Print(__FUNCTION__,
                  ": не удалось создать линию тренда! Код ошибки = ",GetLastError());
            return(0);
            } 

No drawing. The error 4206 (not found subwindow) comes out

The Expert Advisor opens trades as it should be visually. I.e. variables"Time[index],maximum1,Time[1],TRENDmax[1]" are correct.

 
forexman77:

Trying to draw objects in the Expert Advisor, indicator subwindow (MQL4)

The indicator is the same, it means that subwindow should be number 1.

No drawing. Error 4206 (Not found subwindow) comes out

Instead of "1" putChartWindowFind().
 
Karputov Vladimir:
Instead of "1" putChartWindowFind().

How do I get the short name of the indicator in the EA?

In the indicator itself I made a short name

IndicatorShortName("fraktalSDV");
 

Made a script:

void OnStart()
  {
string   shortName="fraktalSDV"; 
long   chart_ID=0;        // ID графика
int win_idx=ChartWindowFind(chart_ID,shortName);
Alert("Окно = ", win_idx);
  }

The window is displayed as it should be.

In the EA:

string   shortName="fraktalSDV"; 
long   chart_ID=0;        // ID графика
int win_idx=ChartWindowFind(chart_ID,shortName);
         Print("shortName=",shortName);
         string nameobj=TimeToStr(Time[0]);          
            //--- сбросим значение ошибки
            ResetLastError();
            //--- создадим трендовую линию по заданным координатам
           if(!ObjectCreate(chart_ID,nameobj,OBJ_TREND,win_idx,Time[index],maximum1,Time[1],TRENDmax[1]))
            {
            Print(__FUNCTION__,
                  ": не удалось создать линию тренда! Код ошибки = ",GetLastError());
            return(0);
            } 

get subwindow number -1

 
forexman77:

Made a script:

The window is displayed as it should be.

In the EA:

get subwindow number -1

Are you sure you have an indicator in the sub-window with short name"fraktalSDV"?
 
Karputov Vladimir:
Are you sure you have an indicator in the sub-window with the short name"fraktalSDV" on the chart?
When I activate the visualisation in the tester, it appears at the end of the run.
 
forexman77:
When I activate the visualisation in the tester, it appears at the end of the run.
Create a template with the indicator and save this template under the name tester.
 
Karputov Vladimir:
Create a template with the indicator and save this template under the name tester.

That is, create a chart profile with the indicator?

I tried to run the indicator in the tester, on slow motion, it is rendered.