Download MetaTrader 5
To add comments, please log in or register
Deposit to your account via PayPal
hgsl12
15
hgsl12 2016.05.29 20:44 

i am trying to create a new chart and add objects to it.

the problem is that the objects appears on the first chart only :(

see below a code example.

why the object doesn't appear in the new opened chart?

void OnInit()

{

         long ChNum = ChartOpen("EURAUD",PERIOD_H4);

         ObjectCreate(ChNum,"a",OBJ_HLINE, 0,0, 1.54); 

         ObjectSetInteger(ChNum,"a",OBJPROP_COLOR,clrDarkOrchid);      

 
Vladimir Karputov
Moderator
42237
Vladimir Karputov 2016.05.29 22:28  
hgsl12:

i am trying to create a new chart and add objects to it.

the problem is that the objects appears on the first chart only :(

see below a code example.

why the object doesn't appear in the new opened chart?

ChartOpen

Return Value

If successful, it returns the opened chart ID. Otherwise returns 0. 

You check a return code? 

hgsl12
15
hgsl12 2016.05.30 17:52  
Karputov Vladimir:

ChartOpen

Return Value

If successful, it returns the opened chart ID. Otherwise returns 0. 

You check a return code? 

Yes, return code is not zero, it is long number. And also a new chart is opened. But objects appear only on old chart :(
Marco vd Heijden
Moderator
4504
Marco vd Heijden 2016.05.30 19:40  

Please check object list to see if the object exists at all .

If it exists but isn't visible then probably parameters are not set properly.

Frederic Metraux
504
Frederic Metraux 2016.05.30 23:23  

You should try

ChartRedraw(ChNum);

After creating your line.

/
To add comments, please log in or register