Other ways for an EA to interrogate a custom indicator?

 

Hi Coders,

 what my custom indicator does is drawing trend lines, sometimes there are more than one displayed on the chart ( 15 is not an exception), other times there is none whatsoever. For this type of work, communication with an EA via iCustom is useless ( or better yet impossible) and I wonder - is there any other way to exchange data between a custom indicator and an EA, or do I have to follow the iCustom paradigm whatever the cost?

 
Martinigue:

Hi Coders,

 what my custom indicator does is drawing trend lines, sometimes there are more than one displayed on the chart ( 15 is not an exception), other times there is none whatsoever. For this type of work, communication with an EA via iCustom is useless ( or better yet impossible) and I wonder - is there any other way to exchange data between a custom indicator and an EA, or do I have to follow the iCustom paradigm whatever the cost?

Why not get the EA to do what the Indicator normally does ?   it then has the information in its own variables.
 
RaptorUK:
Why not get the EA to do what the Indicator normally does ?   it then has the information in its own variables.


My reply to this is - because my indicator needs to draw in the chart.

But a bit of thinking outside my box got me one step further where I might accept the iCustom paradigm and draw one trendline at a time, at most. But I need a bit more of advice here: I do not calculate values, I am just drawing trendlines based on two coordinates ( obviously), therefore I do not have ( or even need) a continuous stream of values to fill a buffer with. However, for an EA to be able to obtain values from a custom indicator, the only way to do so is via such a buffer. So now what is missing in my knowledge of mql development is - after I have ObjectCreate'd a trendline, how do I state that its values should fill a specific buffer? Oh, thinking while writing - obtaining a value by shift might do the trick, am I correct?:-)

 
Martinigue:


My reply to this is - because my indicator needs to draw in the chart.

But a bit of thinking outside my box got me one step further where I might accept the iCustom paradigm and draw one trendline at a time, at most. But I need a bit more of advice here: I do not calculate values, I am just drawing trendlines based on two coordinates ( obviously), therefore I do not have ( or even need) a continuous stream of values to fill a buffer with. However, for an EA to be able to obtain values from a custom indicator, the only way to do so is via such a buffer. So now what is missing in my knowledge of mql development is - after I have ObjectCreate'd a trendline, how do I state that its values should fill a specific buffer? Oh, thinking while writing - obtaining a value by shift might do the trick, am I correct?:-)

Perhaps you could answer a couple of queries ?

1.  if you are going to use an EA to trade for you why does it need the trendline drawn if it knows where the trend line should be ? 

2.  the EA can draw the trendline just like the Indicator can,  why can't you move the Indicator functionality into the EA ? 

 

If you insist on keeping the Indicator and EA separate then all you need do is code the EA to read the properties of the tendlines and then the EA has the information it needs.  ObjectGet() 

 
RaptorUK:

Perhaps you could answer a couple of queries ?

1.  if you are going to use an EA to trade for you why does it need the trendline drawn if it knows where the trend line should be ? 

2.  the EA can draw the trendline just like the Indicator can,  why can't you move the Indicator functionality into the EA ? 

 

If you insist on keeping the Indicator and EA separate then all you need do is code the EA to read the properties of the tendlines and then the EA has the information it needs.  ObjectGet() 


Now you got me confused even more, but a bit happier at the same time. Of course I do not insist on keeping both an indicator and an EA and having more diversified code to maintain, but the table in the Calling Programs for Execution section found here: https://book.mql4.com/basics/programms#Tabl_17 led me to believe that an EA actually cannot display lines.

 One explanaiton that comes to my mind is that what is meant by "displaying lines" here is the usage of data buffers which actually is restricted to indicators. However, if you are able to do your own line creation you can work everything out of your EA. Is my reasoning correct?

 
Martinigue:


Now you got me confused even more, but a bit happier at the same time. Of course I do not insist on keeping both an indicator and an EA and having more diversified code to maintain, but the table in the Calling Programs for Execution section found here: https://book.mql4.com/basics/programms#Tabl_17 led me to believe that an EA actually cannot display lines.

 One explanaiton that comes to my mind is that what is meant by "displaying lines" here is the usage of data buffers which actually is restricted to indicators. However, if you are able to do your own line creation you can work everything out of your EA. Is my reasoning correct?

Yes,  100% correct.

Indicators, Scripts  and EAs can draw Objects but only Indicators can draw lines, histograms and arrows based on Buffers.

 
RaptorUK:

Yes,  100% correct.

Indicators, Scripts  and EAs can draw Objects but only Indicators can draw lines, histograms and arrows based on Buffers.


Splendid! So now I am off to move all of my code to an EA. Thank you for the enlightenment, Sir!:-)
Reason: