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

 
         string   shortName="fraktalSDV"; 
         long   chart_ID=ChartID();        // ID графика
         int win_idx=ChartWindowFind(chart_ID,shortName);
         string nameobj=TimeToStr(Time[0]);
         string name=Time[0]+1; 
         Print("indikator=",win_idx);         
            //--- сбросим значение ошибки
            ResetLastError();
            //--- создадим трендовую линию по заданным координатам
           if(!ObjectCreate(chart_ID,nameobj,OBJ_TREND,win_idx,Time[index],maximum1,Time[1],TRENDmax[1]))
            {
            Print(__FUNCTION__,
                  ": не удалось создать линию тренда! Код ошибки = ",GetLastError());
            return(0);
            } 
           if(!ObjectCreate(chart_ID,name,OBJ_TREND,win_idx,Time[min1],minimum1,Time[1],Low_[1]))
            {
            Print(__FUNCTION__,
                  ": не удалось создать линию тренда! Код ошибки = ",GetLastError());
            return(0);
            }       
           ObjectSet(nameobj,OBJPROP_RAY,false); 
           ObjectSet(name,OBJPROP_RAY,false);
Minus 1 all the same. I also tried making the name of the indicator all small letters, also nothing.
 
forexman77:
Minus 1 all the same. I also tried to make the indicator name all small letters, also nothing.
Did you assign win_idx=1; ? Just take, and specifically set the subwindow number.
 
Artyom Trishkin:
Did you assign win_idx=1; ? Just take, and specifically set the subwindow number.

I tried it, it didn't help. Maybe it's the indicator, but the trades seem to open correctly?

I'll continue tomorrow, it's past my bedtime.

 

I read in the documentation that it is better to make the name of the indicator with parameters.

I did the following in the indicator:

IndicatorSetString(INDICATOR_SHORTNAME,"fraktalsdv("+Period_MA_1+","+ma_shift+","+price+","+Period_+")"); 

in the Expert Advisor:

string   shortName="fraktalsdv("+Period_MA_1+","+ma_shift+","+price+","+Period_+")"; 

The window with the indicator is not detected.

 
forexman77:

I read in the documentation that it is better to make the name of the indicator with parameters.

I did the following in the indicator:

in the Expert Advisor:

The window with the indicator is not detected.

There is clearly a problem in your code, as the test script easily finds standard indicators that are displayed in the sub-window.
 
Karputov Vladimir:
Clearly a problem in your code, because the test script easily finds the standard indicators that are displayed in the subwindow.

But, trades are opened and they are based on the indicator. And the indicator outputs correct values when it prints in the EA.

For some reason I think it's because the indicator doesn't have #property strict line (it doesn't work with it)

 
forexman77:

But, trades are opened and they are based on the indicator. And the indicator outputs correct values when it prints in the EA.

Somehow it seems to me that the indicator does not have #property strict line (it does not work with it)

No, it is not. Try function WindowFind()
 
Artyom Trishkin:
No, it's not. Try the WindowFind() function.
Returns -1.
 
forexman77:
Returns -1.

Look for errors. Indicators are normally searched through

intChartWindowFind(
longchart_id,// chart ID
string indicator_shortname // short indicator name, seeINDICATOR_SHORTNAME

 
forexman77:

No indicator window has been detected.

Do you want to find the indicator that the EA creates for the calculations on the chart? Good luck.
Reason: