how to calculate the total number of arrows on the chart

 

how to calculate the total number of arrows on the chart and put an alert when emerging a new arrow

 
gsudariojr:

how to calculate the total number of arrows on the chart and put an alert when emerging a new arrow

Returns the number of objects ObjectsTotal, and ENUM_OBJECT = OBJ_ARROWED_LINE or another type.

 
Karputov Vladimir:
Returns the number of objects ObjectsTotal, and ENUM_OBJECT = OBJ_ARROWED_LINE or another type.

Show me an example please :/
 

Please.

Advisor counts the number of objects in a given sub-window:


//+------------------------------------------------------------------+
//|                                                 ObjectsTotal.mq5 |
//|                              Copyright © 2015, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2015, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.00"
#property description "Returns the number of objects of the specified type."
//--- input
input ENUM_OBJECT inpObject=OBJ_ARROW_THUMB_UP; // object type
input int inpSub_Window=-1;                         // window index
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   int intCount=ObjectsTotal(0,inpSub_Window,inpObject);
   string count_windows="";
   if(inpSub_Window==-1)
      count_windows="all subwindows";
   else
      count_windows="subwindow № "+IntegerToString(inpSub_Window);
   string text="On the chart in "+count_windows+" is "+IntegerToString(intCount)+" "+EnumToString(inpObject);
   Alert(text);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }
//+------------------------------------------------------------------+
 
Vladimir Karputov:

Please.

Advisor counts the number of objects in a given sub-window:


Thanks!