Issue with my first EA

 

Hi everyone,

 I have a problem with my EA, indeed i want to display a THUMB UP for each tick on the graph, so i wrote the following EA but the problem is that it only displays the thumb for the 1st tick and then no more ticks....

Cheers


Aymeric


int init()
  {
  
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start() // dans int start() le programme se recharge à chaque nouveau tick
{

    ObjectCreate(0,"name",OBJ_ARROW_THUMB_UP,0,Time[0],Bid);
    return(0);

}

 

All objects have to have individual names.

You create an object on the first tick named "name"

2nd tick, the EA cannot create another object with the same name. If you used error reporting, you would see that you get the error "Object already exists". 

 
Thank you for your answer, so is there a solution to make a loop that create the same object over and over ?
 

Okay i just found a nearby solution by adding ObjectDelete("name"); just before ObjetCreate(...) this way the EA display a new thumb for each tick, but is erases the previous one...


So is it possible to save all the thumbs on the graphic ?

 
AYMERIC:

Okay i just found a nearby solution by adding ObjectDelete("name"); just before ObjetCreate(...) this way the EA display a new thumb for each tick, but is erases the previous one...


So is it possible to save all the thumbs on the graphic ?


Yes, add a counter declared outside of any function (after any external inputs, before init)

  int counter=0;
  ObjectCreate(0,"name"+(string)counter,OBJ_ARROW_THUMB_UP,0,Time[0],Bid);
  counter++;

 Remember to delete the objects in deinit

 
Thanks a lot it works !