Dont understand why ObjectCreate is created only once?

Back to topics list To post a new topic, please log in or register
avatar
52
renzbub 2015.07.24 17:54
 

Im trying to get the object OBJ_ARROW_THUMB_UP to appear every time the if condition is true when i test over a few days. Code as follows :

input int MaPeriod = 200;
input ENUM_MA_METHOD MaMethod = MODE_EMA;   
input ENUM_APPLIED_PRICE MaPrice = PRICE_CLOSE;

// OnTick() event handler                
void OnTick()    
{
   double close = Close[1];  
   datetime time = iTime(NULL,0,1);  
   double ma = iMA(_Symbol,_Period,MaPeriod,0,MaMethod,MaPrice,1);    

   // Buy order condition  
   if(close > ma) 
   {                             
      ObjectCreate("Buy",OBJ_ARROW_THUMB_UP,0,time,close);               
   }

   // Sell order condition
   if(close < ma)
   {
      ObjectCreate("Sell",OBJ_ARROW_THUMB_DOWN,0,time,close);
   }
} 

Im using OnTick() event handler as far as i understand this should count every tick that happens. But why does it only displays the object once on each if condition. It doesnt create the object if the condition appears again?

avatar
313
JD4 2015.07.24 19:30 #
 
You have to specify the Object you are trying to create, if you are trying to create multiple Objects, they have to have different names.  You can have multiple Objects of the same type, just not the same names.
avatar
12983
WHRoeder 2015.07.24 20:20 #
 
Do you think your parents could create two renzbub? You created it, with a specific name. You can't create another with the same name.
avatar
120
DeanDeV 2015.07.25 15:22 #
 
WHRoeder:
Do you think your parents could create two renzbub? You created it, with a specific name. You can't create another with the same name.
LOL
Back to topics list  

To add comments, please log in or register