Detect PLOT arrows direction in indicator from expert advisor

 
Hi I am trying to create expert advisor which will detect plot arrows drawn by the indicator instantly and determines whether it is up or down, I have tried too many things, rewrite the code too many times but could not work out anything for plot arrows, One thing I have managed to do was that I detected arrows which were create with ObjectCreate function but it is not the goal, goal is to detect the plot arrows.

on more thing I can't edit indicators code it just prints it, so main complication is that I am only able to create expert advisor I can't touch to indicator.

I would really appreciate any suggestions or thoughts about this,
thank you in advance
 

There are two types of arrows.

  1. Objects. you need to figure out the naming convention, find the arrow, and check its time and arrow code.
  2. Arrow buffers you read with iCustom. Are there values in the data folder?
 
William Roeder:

There are two types of arrows.

  1. Objects. you need to figure out the naming convention, find the arrow, and check its time and arrow code.
  2. Arrow buffers you read with iCustom. Are there values in the data folder?
Hi William I am really glad you answered I was working around this for a week, So I know about Objects they are easy to detect but the task requires to detect arrows which are created with PlotIndexSetInteger() and this is what I need, about values it does not matter cause it should work for different indicators, I was reading about iCustom, but did not really understand how to return arrow value for example up arrow has 233 value, but when I say 
int handle = iCustom(NULL,0,"wprsisignal",  
                     PRICE_CLOSE // using the close prices 
                     ); 

it returns some numbers. Can you please tell me what parameters should I give to the iCustom()  to return Plot arrow values. 
Also there is another problem some indicators have multiple buffers for drawing arrows what happens in this case to the iCustom() ?

I know I am asking too much, but my brain has blown up already, please help. :D

 
You read buffers with iCustom handle. One buffer for each Wingding to show. If the buffer is EMPTY_VALUE (possibly zero) there is no arrow.
 
William Roeder:
You read buffers with iCustom handle. One buffer for each Wingding to show. If the buffer is EMPTY_VALUE (possibly zero) there is no arrow.

my code looks like this right now, should it prin 233 if arrow appears in indicator ? 

EA it returns 10 iin "handle" vriable:

int OnInit()
  {
   return(INIT_SUCCEEDED);
  }

void OnTick()
  {
   int handle=iCustom(NULL,0,"event",  
                     PRICE_CLOSE // using the close prices 
                     );  
    Print(handle);
    
    IndicatorRelease(handle);
  }

And Inidicator code:

//+------------------------------------------------------------------+
//|                                                        event.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1

#property indicator_label1  "MA"
#property indicator_type1   DRAW_ARROW
#property indicator_color1  clrYellow
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
int counter = 0;
double buffer[];
int OnInit(){
   ArraySetAsSeries(buffer,true);
   SetIndexBuffer(0,buffer);
   PlotIndexSetInteger(0,PLOT_ARROW,233);
   
   IndicatorSetString(INDICATOR_SHORTNAME,"MA("+IntegerToString(_Period)+")");
   return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],
                const double &low[],const double &close[],const long &tick_volume[],const long &volume[],const int &spread[]){

   for(int i=30;i>=0;i--)
     {
      buffer[i]=iHigh(_Symbol,_Period,i);
     }
    
   return(rates_total);
}
/*
void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
  {
   counter+=1;
   Print(IntegerToString(counter)+"some: ", IntegerToString(id));
  }
*/
 
campfire3: my code looks like this right now, should it prin 233 if arrow appears in indicator ? 

EA it returns 10 iin "handle" vriable:

Perhaps you should read the manual.
  1. You read the buffer. Your buffer contains the candle high. Why do you think you would read 233?
  2. Perhaps you should read the manual, especially the examples. They all (including iCustom) return a handle (an int.) You get that in OnInit. In OnTick you use the handle, shift and count to get the data.
              Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
              Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5

    Creating an iMA indicator handle, getting indicator values.
              How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08

    Also see my example for encapsulating calls
              Detailed explanation of iCustom - MQL4 programming forum

 
William Roeder:
Perhaps you should read the manual.
  1. You read the buffer. Your buffer contains the candle high. Why do you think you would read 233?
  2. Perhaps you should read the manual, especially the examples. They all (including iCustom) return a handle (an int.) You get that in OnInit. In OnTick you use the handle, shift and count to get the data.
              Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
              Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5

    Creating an iMA indicator handle, getting indicator values.
              How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08

    Also see my example for encapsulating calls
              Detailed explanation of iCustom - MQL4 programming forum

Yeah I understood you need to use CopyBuffer with this indicator handle to copy buffer from indicator to some variable,

Last one question, what I am trying to do is to detect those arrows from EA I see how it is possible from iCustom, But my goal is to this EA should work for any inidicator I would give it without knowing the indicators code by myself, do you think I can get there ? or it is impossible ?
 
campfire3 #:
Yeah I understood you need to use CopyBuffer with this indicator handle to copy buffer from indicator to some variable,

Last one question, what I am trying to do is to detect those arrows from EA I see how it is possible from iCustom, But my goal is to this EA should work for any inidicator I would give it without knowing the indicators code by myself, do you think I can get there ? or it is impossible ?

Hi, campire,

I'm in the same situation, did you manage to find the necessary code?

 
 

Here are all object function listed: https://www.mql5.com/en/docs/objects.

Loop through all object (=ObjectsTotal()), get the name of the actual one in the list with ObjectName() and now you can find the object with ObjectFind().

Documentation on MQL5: Object Functions
Documentation on MQL5: Object Functions
  • www.mql5.com
Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
The Fractals indicator has one plot buffer for up and one for down arrows. It is a good example, and you can make many indicators in a similar way, even if their calculations are different. 

So you need to get into icustom and experiment with copybuffer to get the values from the indicators then display thr values from the buffers to look which is which.
In each case you need to put icustom into Oninit.

If arrow objects are used it is a different story.

Reason: