How can I Make a Expert Advisor from this Indicator

 
I understand the basics of making an expert advisor and have seen some posts that mention that I should use iCustom function to access my indicator in an expert advisor, but it's not too clear. I want to make an expert advisor that takes a trade when the "X" and arrow appear at the same time, as in the image below. According to the indicator this is recognised as a "strong buy" or "strong sell". Would really appreciate some help.
 
Pipillioniare:
I understand the basics of making an expert advisor and have seen some posts that mention that I should use iCustom function to access my indicator in an expert advisor, but it's not too clear. I want to make an expert advisor that takes a trade when the "X" and arrow appear at the same time, as in the image below. According to the indicator this is recognised as a "strong buy" or "strong sell". Would really appreciate some help.

Hi,

what exactly is "not clear" with iCustom? Can you share your code with your attempts of using it?

 
Andrey Barinov:

Hi,

what exactly is "not clear" with iCustom? Can you share your code with your attempts of using it?

Okay, iCustom returns a double value. How am I suppose to use this double value to setup bool conditions to enter/exit orders for "strong buy" and "strong sell"? Please see what I've done. I haven't setup the conditions for the trades, they're blank if conditions.
Files:
SSEA.mq4  9 kb
 
Pipillioniare:
Okay, iCustom returns a double value. How am I suppose to use this double value to setup bool conditions to enter/exit orders for "strong buy" and "strong sell"? Please see what I've done. I haven't setup the conditions for the trades, they're blank if conditions.

Well, in your case. If there is an arrow, the iCustom returns the value which is greater than 0. So, your condition would be if(value>0). If you need a few buffers it will be like if(buffer1value>0 && buffer2value>0)

Because, if there is no arrow it returns either 0 or EMPTY_VALUE, depending on how the indicator is coded.

 

Or you could just reverse engineer the indicator and add the logic directly into an EA

Something like:

Don't loop over "limit" to calculate hhb1,llb1,hhb,llb and b1,b2,b3,b4

Just calculate them with an offset of 1

From here you can use the same logic that sets the alerts to open/close the trades

 
Andrey Barinov:

Well, in your case. If there is an arrow, the iCustom returns the value which is greater than 0. So, your condition would be if(value>0). If you need a few buffers it will be like if(buffer1value>0 && buffer2value>0)

Because, if there is no arrow it returns either 0 or EMPTY_VALUE, depending on how the indicator is coded.

Please I don't understand how to get buffer1value and buffer2value. What will be my precise if conditions for both "strong buy" and "strong sell", based on the EA I provided? Or what would be my if condition for an upward arrow with "X" and a downward arrow with "X"?
 
Pipillioniare:
Please I don't understand how to get buffer1value and buffer2value. What will be my precise if conditions for both "strong buy" and "strong sell", based on the EA I provided? Or what would be my if condition for an upward arrow with "X" and a downward arrow with "X"?

customInd = iCustom(Null, 0, "Super Signal v3d", 21, 14, true, false, false, false, false, BUFER_INDEX, 0);

Where BUFER_INDEX write buffer number indicator whose value you need to. 

Your indicator has 4 buffers. Zero to three. 
 
Vitalii Ananev:

customInd = iCustom(Null, 0, "Super Signal v3d", 21, 14, true, false, false, false, false, BUFER_INDEX, 0);

Where BUFER_INDEX write buffer number indicator whose value you need to. 

Your indicator has 4 buffers. Zero to three. 
If the buffers are from 0 to 3, how do I tell which value represents "strong buy" and "strong sell"? I don't fully understand I should use the buffers. Please, I would be more than grateful if you could show me an example directly related to my buy/sell if conditions, and explain further how I should use the buffer.
 
Pipillioniare:
If the buffers are from 0 to 3, how do I tell which value represents "strong buy" and "strong sell"? I don't fully understand I should use the buffers. Please, I would be more than grateful if you could show me an example directly related to my buy/sell if conditions, and explain further how I should use the buffer.

The code of the indicator shows that the zero buffer is the yellow arrow, and the first buffer is the lime arrow.

#property indicator_color1 Yellow

#property indicator_color2 Lime

A strong sale will be

....
double buf0 = iCustom(Null, 0, "Super Signal v3d", 21, 14, true, false, false, false, false, 0, 1);

double buf2 = iCustom(Null, 0, "Super Signal v3d", 21, 14, true, false, false, false, false, 2, 1);

if (buf0 != EMPTY_VALUE && buf2 != EMPTY_VALUE) Alert("strong sell");
...

Strong  buy

....

double buf1 = iCustom(Null, 0, "Super Signal v3d", 21, 14, true, false, false, false, false, 1, 1);

double buf3 = iCustom(Null, 0, "Super Signal v3d", 21, 14, true, false, false, false, false, 3, 1);

if (buf1 != EMPTY_VALUE && buf3 != EMPTY_VALUE) Alert("strong buy");

...

All this can be seen from the source code of the indicator.

....  
if (alertsOn)
      {
         int forBar = 1;
            if (alertsOnCurrent) forBar = 0;
            if (b1[forBar] != EMPTY_VALUE && b3[forBar] != EMPTY_VALUE) doAlert("strong sell");
            if (b1[forBar] != EMPTY_VALUE && b3[forBar] == EMPTY_VALUE) doAlert("sell");
            if (b1[forBar] == EMPTY_VALUE && b3[forBar] != EMPTY_VALUE) doAlert("minor sell or exit buy");
            if (b2[forBar] != EMPTY_VALUE && b4[forBar] != EMPTY_VALUE) doAlert("strong buy");
            if (b2[forBar] != EMPTY_VALUE && b4[forBar] == EMPTY_VALUE) doAlert("buy");
            if (b2[forBar] == EMPTY_VALUE && b4[forBar] != EMPTY_VALUE) doAlert("minor buy or exit sell");
      }
....

Where b1 [] is the zero buffer b2 [] is the first buffer b3 [] is the second buffer and b4 [] is the third buffer.

 
Vitalii Ananev:

The code of the indicator shows that the zero buffer is the yellow arrow, and the first buffer is the lime arrow.

#property indicator_color1 Yellow

#property indicator_color2 Lime

A strong sale will be

Strong  buy

All this can be seen from the source code of the indicator.

Where b1 [] is the zero buffer b2 [] is the first buffer b3 [] is the second buffer and b4 [] is the third buffer.

Thanks a lot. I know have a better understanding of how the buffer works. I am getting a ""Null" undeclared identifier" error pointing to the line "double buf0 = iCustom(Null, 0, "Super Signal v3d", 21, 14, true, false, false, false, false, 0, 0);" which is in "start()"
 
Pipillioniare:
Thanks a lot. I know have a better understanding of how the buffer works. I am getting a ""Null" undeclared identifier" error pointing to the line "double buf0 = iCustom(Null, 0, "Super Signal v3d", 21, 14, true, false, false, false, false, 0, 0);" which is in "start()"
Okay, I solved it. I am suppose to use "NULL" instead of "Null"
Reason: