Why arrow is not drawed on chart?

 
void OnTick()
{
   // Print("tick event");
   
   /*ObjectCreate("pasol", OBJ_ARROW, 0, Time[0], 104.9, Time[0], 104, Time[0], 104.1); //draw an up arrow
      ObjectSet("pasol", OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet("pasol", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
      ObjectSet("pasol", OBJPROP_COLOR,LineColor);*/
      
      
      // https://www.mql5.com/en/forum/110906
      string name = "text_object";

      /*if(ObjectFind(name ) != -1) ObjectDelete(name);
      ObjectCreate(name, OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText(name, "Hello world!", 10, "Times New Roman", Green);
      ObjectSet(name, OBJPROP_COLOR, Green);
      ObjectSet(name, OBJPROP_CORNER, 0);
      ObjectSet(name, OBJPROP_XDISTANCE, 100);
      ObjectSet(name, OBJPROP_YDISTANCE, 200);*/
      
      
      //sif(ObjectFind(name) != -1) ObjectDelete(name);
      
      Print("time 0: " + Time[0]);
      
         ObjectCreate(name, OBJ_TEXT, 0, 0, 0, 0, 0);
         ObjectSetText(name, name);
         ObjectSet(name, OBJPROP_COLOR, Green);
         //ObjectSet(name, OBJPROP_TIME1, Time[0]+2*Period()*60);
         ObjectSet(name, OBJPROP_TIME1, Time[0]);
         ObjectSet(name, OBJPROP_PRICE1, High[0]);

}


Hello, 

cannot make anything be drawed near candle.

Why is that? I was able to draw label but once I want it to draw near candle, it is impossible. What is wrong with the code?


Later noticed that arrow is drawed at the end of tested time. And turned on visual mode - I see arrow moves. I want arrow to stay where are they drawed, so see when signals started.

Can anyone give me a ObjectCreate sample? I create one and it doesn't work. Thanks.
Can anyone give me a ObjectCreate sample? I create one and it doesn't work. Thanks.
  • 2008.09.09
  • www.mql5.com
My code is, help me to make it work...
 
Please edit your post and

use the code button (Alt+S) when pasting code

   /*ObjectCreate("pasol", OBJ_ARROW, 0, Time[0], 104.9, Time[0], 104, Time[0], 104.1); //draw an up arrow
      ObjectSet("pasol", OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet("pasol", OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
      ObjectSet("pasol", OBJPROP_COLOR,LineColor);*/

Of course your arrow won't be drawn.

 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  2. There are text objects and label objects. Use the correct one. create anchored labels - MQL4 programming forum 2017.01.07

  3.        ObjectCreate(name, OBJ_TEXT, 0, 0, 0, 0, 0);
             ⋮
             ObjectSet(name, OBJPROP_TIME1, Time[0]);
             ObjectSet(name, OBJPROP_PRICE1, High[0]);
    You can set the price and time on the create call.
 

Thanks, made it finnaly work. Problem was that it was same name and it kept updating the object and drawed it at the end of chart which at first I did not even notice.


   string name = "ble" +  TimeCurrent();
   
   Print(name);
   
   ObjectCreate(name, OBJ_ARROW, 0, Time[0], 104.9); //draw an up arrow
      ObjectSet(name , OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_ARROWUP);
      ObjectSet(name, OBJPROP_COLOR, White);
Reason: