objects don't appear on new chart through EA

 

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);      

 
 
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? 

 
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 :(
 

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.

 

You should try

ChartRedraw(ChNum);

After creating your line.

Reason: