Multiple copies of same indicator on chart

 

Hi

I wonder if anyone can point me in the right direction so I know how to change some code so that I

can get several copies of the same indicator on my chart.   I keep running into this problem, but

unable to find a data sheet on it.    I can get round it by renaming objectsCreate but this takes ages

and I feel there must be an easier way 

 

Many thanks, regards

kate

 
kate682:

Hi

I wonder if anyone can point me in the right direction so I know how to change some code so that I

can get several copies of the same indicator on my chart.   I keep running into this problem, but

unable to find a data sheet on it.    I'm gradually learning more and more, but this is a hiccup

I keep running into.  

 

Many thanks, regards

kate

Can you be more specific?

Is it about interference between objects?

Then you have to make sure that every separate indicator will use it's own objects.

If they all generate objects with the same name then one indicator will affect objects from the other,

So you have to make sure that each indicator uses it's own unique objects.

This can be done by generating a random number

MathRand();

And then adding this random number to the object name by

ObjectCreate(0,"objectname"+IntegerToString(uniquerandomnumber),....


so that every instance or separate indicator has its own objects and because the unique random number differs between indicators it can be used as identifier.

 

If you need to run same indicator on same chart but with different settings, you just need to add indicators as much as you want and change

every indicator instance settings. At the end save then as a template.

The best example for this is the Rainbow indicator. It contains many Moving averages with different settings.

Not sure if this helps !!!. 

 
Marco vd Heijden:

Can you be more specific?

Is it about interference between objects?

Then you have to make sure that every separate indicator will use it's own objects.

If they all generate objects with the same name then one indicator will affect objects from the other,

So you have to make sure that each indicator uses it's own unique objects.

This can be done by generating a random number

And then adding this random number to the object name by


so that every instance or separate indicator has its own objects and because the unique random number differs between indicators it can be used as identifier.

Thank you very much for that Marco,

I have now reamed each object for each MTF version of the same indicator.  They work fine now.

Was hoping that I could just create a global uniqueID for it, as there are around 10 objects to do :-) 

Regards

Kate

xxx 

Reason: