how to calculate the total number of arrows on the chart

Start making profit using the Market. Publish your product!
20
2015.09.23 04:28

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

Moderator
46058
2015.09.23 17:37
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.

20
2015.09.23 21:49
Returns the number of objects ObjectsTotal, and ENUM_OBJECT = OBJ_ARROWED_LINE or another type.

Show me an example please :/
Moderator
46058
2015.09.24 08:46

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

```//+------------------------------------------------------------------+
//|                                                 ObjectsTotal.mq5 |
//|                                           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);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

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

}
//+------------------------------------------------------------------+
```