make EA from an Indicator

 

Hi,

I would like to make an EA from an Indicator, and my problem is: the indicator paint an arrow and make alert, how can I capture the paint arrow. I tried iCustom, but unluncky, not got results.

Anybody can tell me with example how can I capture the arrow paint?

 

I believe the iCustom are for taking values from an indicator not implementing them, As far as im aware you cant initiate an indicator from an EA so what you really want is some value from the indicator? Other wise just put the indicator on the chart aswell?

 For example i have a simple line of best fit indicator, with various lines etc but i only use it to check that the values are correct in my EA, just visual reference. 

 
Thanks for reply, I want to make EA from an indicator, so I need capture the arrow and open and order. How can I do this? When the indicator paint an arrow, how can I "capture"?
 

Indicator: 

First you need the buffer:

 double EABuffer[];

 

Then you need to "send" some value to the EA, for example:

RSItemp = iRSI(NULL,0,RSIperiod,PRICE_CLOSE,0);

if (RSItemp < 30){
  EABuffer[0] = 1; // Or any number that you like to translate as a "buy"
}

if (RSItemp > 70){
  EABuffer[0] = 2; // Or any number that you like to translate as a "sell"
}
EABuffer[0] = 0; // Just to set a value that is neither a buy or sell when RSItemp is between 30 and 70

 

So in the EA you need to:

 

 double InfoFromIndicator;
   InfoFromIndicator=iCustom(NULL,0,"nameOfYourIndicator",3,0);

     if(InfoFromIndicator==1){
// Make whatever you need to make for a Buy
        }


     if(InfoFromIndicator==2){
// Make whatever you need to make for a Sell        
        }

 

Let me know if it was of any help :)

 

it seems to I have to use the iCustom function, (i dont have the indicator source code) but the iCustom shows only zero or 2147483647.0

still unlucky. Any suggestion?

 
phil09:

it seems to I have to use the iCustom function, (i dont have the indicator source code) but the iCustom shows only zero or 2147483647.0

still unlucky. Any suggestion?

Sorry, then it is impossible.
 
phil09 I want to make EA from an indicator, I tried iCustom, but unluncky, not got results.
  1. Don't do that. Just get the value of the indicator. Detailed explanation of iCustom - MQL4 forum
  2. "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.
 

Thanks WHRoeder,

I dont give up. My Metatrader 920 dont make an EX4 file (Win 10 issue), and crash when I try compile with older Metaeditor but this is another story...

When I hoover over the painted arrow it shows the name and a price value, thats means (if have name) the arrows painted not by an indicator?

Now I'm try ObjectsTotal() function.

Update: It seems that the arrow is an object.

 
phil09:

Thanks WHRoeder,

I dont give up. My Metatrader 920 dont make an EX4 file (Win 10 issue), and crash when I try compile with older Metaeditor but this is another story...

When I hoover over the painted arrow it shows the name and a price value, thats means (if have name) the arrows painted not by an indicator?

The indicator may place arrows on the chart as objects instead of using buffers. This would mean that you would have to look for the object instead of using iCustom.
Reason: