MQL5 EA not drawing arrows

 

Hi everyone,


I'm trying to draw a simple arrow with the following code snippet. If I change it to a label it works, but for arrows it doesn't show anything on the graph (neither live nor in backtest).


Your help and ideas are much appreciated :-)


switch(ObjectFind(0,label))
        {
         case -1:
            ObjectCreate(ChartID(),label,OBJ_ARROW_DOWN,0,0,SYMBOL_BID);
            ObjectSetInteger(ChartID(),label,OBJPROP_ARROWCODE,252);
            ObjectSetInteger(ChartID(),label,OBJPROP_ANCHOR,ANCHOR_BOTTOM);
            ObjectSetInteger(ChartID(),label,OBJPROP_WIDTH,15);
            ObjectSetInteger(ChartID(),label,OBJPROP_COLOR,clrRed);
            ObjectSetInteger(ChartID(),label,OBJPROP_STYLE,STYLE_SOLID);
            ObjectSetInteger(ChartID(),label,OBJPROP_HIDDEN,false);
            ObjectSetInteger(ChartID(),label,OBJPROP_BACK,false);
            ObjectSetString(ChartID(),label,OBJPROP_TEXT,IntegerToString(ObjectGetInteger(ChartID(),label,OBJPROP_TIME)));
            break;

         case 0:
            break;
        }
 

Alright, guys - solved it myself


Here's the code that works for me now (changes highlighted in yellow):


 switch(ObjectFind(0,label))
     {
      case -1:
         ObjectCreate(ChartID(),label,OBJ_ARROW_DOWN,0,TimeCurrent(),SymbolInfoDouble(Symbol(),SYMBOL_BID));
            ObjectSetInteger(ChartID(),label,OBJPROP_ARROWCODE,252);
            ObjectSetInteger(ChartID(),label,OBJPROP_ANCHOR,ANCHOR_BOTTOM);
            ObjectSetInteger(ChartID(),label,OBJPROP_WIDTH,3);
            ObjectSetInteger(ChartID(),label,OBJPROP_COLOR,clrRed);
            ObjectSetInteger(ChartID(),label,OBJPROP_STYLE,STYLE_SOLID);
            ObjectSetInteger(ChartID(),label,OBJPROP_HIDDEN,false);
            ObjectSetInteger(ChartID(),label,OBJPROP_BACK,false);
            ObjectSetString(ChartID(),label,OBJPROP_TEXT,IntegerToString(ObjectGetInteger(ChartID(),label,OBJPROP_TIME)));
         break;

      case 0:
         break;
     }
Reason: