Is it possible for an EA to open a trade when an indicator places an arrow on the current candle or a previous candle? If yes, how?
Yes it can, but the question is so vague, that it would be difficult to answer in just a few posts. Your query, is equivalent to asking how to build a car. So unless you
first learn the basics of metal work and mechanics and electronics, it
would be impossible for someone to explain to you how to build a car in
just a few posts.
So, you should first learn the basics of coding in MQL by going through example code available in the CodeBase, as well as referencing the Documentation, either online or via the help feature in the MetaEditor.
On the forums it is customary for users to post their coding attempts with the specifics of the problems they had. Then other posters will comment and offer advice.
If however, you do not wish to learn and go through the long process of reaching that level of skill that is required, then you can always hire someone in the Freelance section to code it for you.
I know how to code an EA. I have an indicator that places an arrow where a trade say a BUY or a SELL can be placed. I know that we use code below to get the values of the signal.
double signal_v = iCustom(Symbol(),PERIOD_M1, "My Custom Indicator", 0, 1);
The indicator in this question places an arrow, and I want to know if there is a way one can tell if an arrow has been placed on the current or previous candle by this specific indicator. I have seen any sample codes so I was asking. Kindly.
If the arrow is placed by a "buffer" that you can access it via the iCustom() function as usual, but since you have not provided any information on the indicator you are using, we cannot guess which buffer index or at what bar this would happen.
If the Custom indicator, however uses graphical objects (and not via a "buffer") to place the arrow, then we would need access to the source code of the Indicator in order to offer a solution.
EDIT: You can also provide a screen shot of the Data Window (completely) while hovering over the bar with the arrow and that might help identify the buffer index.
Hi Fernando, here is the screen shot of the data window
And here are the arrows
The indicator https://www.mql5.com/en/code/8184?utm_campaign=codebase.list&utm_medium=special&utm_source=mt4terminal is the one I am using. When there is an arrow, the X up has some value for for upward arrow and the same applies for X dn How can we use iCustom to get tell whether the arrow is up or down? I want to use it for previous candle since this particular indicator repaints.
Well, you answered your own question ... the arrows are the "X up" and "X dn" buffers, Line index 0 and 1 respectively.
In the source code the "empty value" is zero! So when iCustom() for Line Index 0 returns a value greater than zero, then the Arrow is Up; and when iCustom() for Line Index 1 returns a value greater than zero then the Arrow is Down.
string symbol, // symbol
int timeframe, // timeframe
string name, // path/name of the custom indicator compiled program
... // custom indicator input parameters (if necessary)
int mode, // line index
int shift // shift
Thanks so much!