ObjectCreate( ) question

 
Is there a way to keep drawing an object on a chart, with the same name, continuously? Is there a way to make the name a variable?
 
Yellowbeard wrote >>
Is there a way to keep drawing an object on a chart, with the same name, continuously? Is there a way to make the name a variable?

No, you have to change the name, the way I do it is thus:

ObjectCreate(StringConcatenate(name,TimeCurrent()).......)

I use TimeCurrent because it changes every second, if you are doing work at the tick level you might, need to use another function which changes

faster, a tick count for example, or even a random number generator(don't know if MT4 has one)

HTH

Keith

 

Thanks for the input!

Name = "ArrowUpA"

PeriodA = (iClose(NULL,1,0)

ObjectCreate(StringConcatenate("ArrowUpA",OBJ_ARROW,0,TimeCurrent(),PeriodA));

Getting wrong parameters count.

Must be something I have wrong. Can you tell?

 
Yellowbeard wrote >>

Thanks for the input!

Name = "ArrowUpA"

PeriodA = (iClose(NULL,1,0)

ObjectCreate(StringConcatenate("ArrowUpA",OBJ_ARROW,0,TimeCurrent(),PeriodA));

Getting wrong parameters count.

Must be something I have wrong. Can you tell?

for sure the first part in red should be

ObjectCreate(StringConcatenate(ArrowUpA,TimeCurrent()), OBJ_ARROW,0,Ask);

this creates the unique name each iteration, I'm not too sure what parameters arrow takes, try what I have if that doesn't work you'll

have to research what the correct parameters are.

good luck

keith

 
kminler wrote >>

for sure the first part in red should be

ObjectCreate(StringConcatenate(ArrowUpA,TimeCurrent()), OBJ_ARROW,0,Ask);

this creates the unique name each iteration, I'm not too sure what parameters arrow takes, try what I have if that doesn't work you'll

have to research what the correct parameters are.

good luck

keith

Got it to work with:

ObjectCreate(StringConcatenate("ArrowUpA",TimeCurrent()),OBJ_ARROW,0,Time[0],PeriodA);

Thanks! For the help!

Now working on creating one for ArrowDown, and assigning the color lime for ArrowUp and red for ArrowDown.

Thanks again!

Reason: