[MQL4] On object create on chart

 
Hello guys, 
I have an indicator (.ex4) which creates dots on the chart. I'm trying to understand if it is possible to know (with MQL4) when the dots appear, and generate an alert.

This is a screen of my indicator



Thanks in advance.
 
gabrisal94:
Hello guys, 
I have an indicator (.ex4) which creates dots on the chart. I'm trying to understand if it is possible to know (with MQL4) when the dots appear, and generate an alert.

This is a screen of my indicator



Thanks in advance.

You can use an iCustom call to find the dots if the indicator uses buffers.

Looking at that image I am almost certain that it is a repainting indicator so you may find that you cannot get an alert when the dot happens

 
Keith Watford:

You can use an iCustom call to find the dots if the indicator uses buffers.

Looking at that image I am almost certain that it is a repainting indicator so you may find that you cannot get an alert when the dot happens

Thanks for the reply, the indicator in the figure is only for an example (i know that repaints!)
 

You want to know if a dot exists on a specific bar. Just get the value of the indicator, (one of two buffers,) and see if it is EMPTY_VALUE or not.

You should write a self documenting function instead of calling iCustom directly, see Detailed explanation of iCustom - MQL4 forum

 
whroeder1:

You want to know if a dot exists on a specific bar. Just get the value of the indicator, (one of two buffers,) and see if it is EMPTY_VALUE or not.

You should write a self documenting function instead of calling iCustom directly, see Detailed explanation of iCustom - MQL4 forum

I tried this code but it does not work:


int start()
{

double buffer1 = iCustom(NULL,0,"myIndicator",10000,true,true,"alert2.wav","email.wav",false, 0, 0);
double buffer2 = iCustom(NULL,0,"myIndicator",10000,true,true,"alert2.wav","email.wav",false, 1, 0);

if(buffer1!=0 )     // I tried with -> if(buffer1!=EMPTY_VALUE) but buffer1 always returns 0 .
        Alert(buffer1);

    if(buffer2!=0)
       Alert(buffer2);


return 0;
}
 
gabrisal94: I tried this code but it does not work:
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  2. You previously said it repaints. Why do you expect an arrow on the currently forming bar? (The fractal indicator doesn't repaint, but it never puts a chevron on bars zero, one or two.)
 
whroeder1:
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  2. You previously said it repaints. Why do you expect an arrow on the currently forming bar? (The fractal indicator doesn't repaint, but it never puts a chevron on bars zero, one or two.)
The indicator what i'm using does not repaint.
"Does not work" in the sense that the two buffers do not return a value different from zero.
There is another way to see if exists a dot on the chart?
 
gabrisal94:
The indicator what i'm using does not repaint.
"Does not work" in the sense that the two buffers do not return a value different from zero.
There is another way to see if exists a dot on the chart?
  1. It doesn't repaint? That's not what you previously said.
    gabrisal94: Thanks for the reply, the indicator in the figure is only for an example (i know that repaints!)

  2. We don't know your indicator, we don't know that there are only two buffers or even if it is using any buffers, and we certainly don't know if it ever paints a dot on bar zero.
  3. Open the data window, look at the values displayed when you hover over a bar with a dot and without.
 
whroeder1:
  1. It doesn't repaint? That's not what you previously said.
  2. We don't know your indicator, we don't know that there are only two buffers or even if it is using any buffers, and we certainly don't know if it ever paints a dot on bar zero.
  3. Open the data window, look at the values displayed when you hover over a bar with a dot and without.

1) I have said: "the indicator in the figure is only for an example".
2) Here you are the screen with dot and without

Green dot

Red dot

without dot

 

Thanks 

 

As WHRoeder has said, some indicators do not place any value in the buffer for the current bar. In such cases you will not get any value returned for

double buffer1 = iCustom(NULL,0,"myIndicator",10000,true,true,"alert2.wav","email.wav",false, 0, 0);


try

double buffer1 = iCustom(NULL,0,"myIndicator",10000,true,true,"alert2.wav","email.wav",false, 0, 1);


and other values
 

what to do if indicator draw arrow as object in the chart (Some indicators do not have up and down buffers)